Skip to content
Snippets Groups Projects
Commit c54cf8e3 authored by fcrisafulli-dev's avatar fcrisafulli-dev
Browse files

database init code

parent f9491d99
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -9,16 +9,23 @@ def init_database():
connection = sqlite3.connect("crisis_events.db")
cur = connection.cursor()
cur.execute("CREATE TABLE movie(title, year, score)")
cur.execute("""
INSERT INTO movie VALUES
('Monty Python and the Holy Grail', 1975, 8.2),
('And Now for Something Completely Different', 1971, 7.5)
""")
with open("init_database.sql","r") as f:
sql = f.read()
cur.executescript(sql)
# cur.execute("CREATE TABLE movie(title, year, score)")
res = cur.execute("SELECT name FROM sqlite_master")
print(res.fetchone())
# cur.execute("""
# INSERT INTO movie VALUES
# ('Monty Python and the Holy Grail', 1975, 8.2),
# ('And Now for Something Completely Different', 1971, 7.5)
# """)
# res = cur.execute("SELECT * FROM event_collections")
# print(res.fetchone())
cur.close()
connection.close()
......
DROP TABLE
\ No newline at end of file
DROP TABLE IF EXISTS event_collections;
CREATE TABLE event_collections(
collection_id INTEGER PRIMARY KEY,
owner_id INTEGER,
collection_binary BLOB,
collection_summary TEXT
);
INSERT INTO event_collections VALUES
(0, 15, "binary", "Summary for collection 0"),
(1, 15, "binary", "Summary for collection 1");
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment