34 lines
641 B
Python
34 lines
641 B
Python
import sqlite3
|
|
# import csv
|
|
|
|
conn = sqlite3.connect('bank_schema.png')
|
|
|
|
c = conn.cursor()
|
|
|
|
# c.execute("""drop table users;""")
|
|
c.execute("""CREATE TABLE 'users' (
|
|
id int,
|
|
name varchar,
|
|
username varchar,
|
|
date_created date,
|
|
permission int,
|
|
PRIMARY KEY (id)
|
|
)""")
|
|
|
|
# c.execute("""drop table accounts;""")
|
|
c.execute("""CREATE TABLE 'accounts' (
|
|
id int,
|
|
account_number int,
|
|
balance int,
|
|
user_id int,
|
|
PRIMARY KEY (id),
|
|
FOREIGN KEY (user_id) references users(id)
|
|
)""")
|
|
|
|
|
|
with open ('bank_schema.png', 'r') as bank_schema:
|
|
creader = csv.reader(bank_schema, delimiter = ',')
|
|
column_names = creader.__next__()
|
|
|
|
conn.commit()
|
|
c.close() |