I am writing a basic program in python and using sqlite3 as my database to store information.
I am trying to select some data from my database so that I can use it in my program, I have done this before in the program several times however this statement isn't working.
db_cursor.execute("SELECT startDate, renewalPeriod, description, income, expense"
"FROM IncomeExpense "
"WHERE accountID = {}".format(account_id))
The error I am getting is:
sqlite3.OperationalError: no such column: startDate
This is the sql for table design:
CREATE TABLE IncomeExpense (
rowID INTEGER PRIMARY KEY AUTOINCREMENT,
startDate TEXT NOT NULL,
renewalPeriod INTEGER NOT NULL,
description TEXT NOT NULL,
type TEXT NOT NULL,
income FLOAT NOT NULL,
expense FLOAT NOT NULL,
accountID INTEGER,
FOREIGN KEY (accountID) REFERENCES Account(accountID));
The kicker is that when I manually type that select statement into the sqlite3 terminal it gives me the data no problem. I have included an image of the output I get when I enter it manually however I have blocked out the description, income and expense columns as they contain personal information.
Image of output in sqlite3 terminal
I am not sure if it is something simple I am missing in this statement however any assistance would be greatly appreciated.
Thanks :)