Open MichaelGame-Dev opened 3 years ago
Meet too.
Hi, i had the same problem, In my Folder was the File to_do.db with 0 Bytes. So the Database was createt but no Tables. I fix the Problem with the following code: In the File to_do_list.py Add after line 8 this content import sqlite3 verbindung = sqlite3.connect("to_do.db") zeiger = verbindung.cursor()
Erstelle neue Datenbank sql_anweisung = """ CREATE TABLE IF NOT EXISTS Tasks ( TaskID integer, Description text, Deadline date, Created timestamp, Completed timestamp, ProjectID integer, PRIMARY KEY(TaskID), FOREIGN KEY(ProjectID) REFERENCES Projects(ProjectID) );"""
zeiger.execute(sql_anweisung)
Beginn Table Projects sql_anweisung = """ CREATE TABLE IF NOT EXISTS Projects ( ProjectID integer, Description text, Deadline date, Created timestamp, Completed timestamp, PRIMARY KEY(ProjectID) );"""
zeiger.execute(sql_anweisung) verbindung.close()
Take Care that the File to_do.db is not in the Folder. So you will create a the Database with the Tables Tasks und Projects. The DB will only create if there is no DB
Whenever I try to run the main to_do.py file, I get the error that the Tasks table doesn't exist.
I do see to_do.db getting created but no tables actually get created. I have went in manually using DBeaver and created the tables and had the program work after that. I'd just like to get the create table statements to work as expected. I'm running linux if it matters.