ejeiffe / To-Do-List

GUI application for managing tasks and projects.
MIT License
22 stars 6 forks source link

SQL Create statements are not working for me #1

Open MichaelGame-Dev opened 3 years ago

MichaelGame-Dev commented 3 years ago

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.

biysw11 commented 3 years ago

Meet too.

Petersenf87 commented 1 year ago

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