File size: 497 Bytes
1e66e59 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import json
import sqlite3
connection = sqlite3.connect('ChennaiRainFall.db')
cursor = connection.cursor()
cursor.execute('Create Table if not exists RainFall (name Text, course Text, roll Integer)')
n
traffic = json.load(open('json_file.json'))
columns = ['name','course','roll']
for row in traffic:
keys= tuple(row[c] for c in columns)
cursor.execute('insert into Student values(?,?,?)',keys)
print(f'{row["name"]} data inserted Succefully')
connection.commit()
connection.close()
|