Reputation: 2142
I'm getting the sqlite3.OperationalError: no such colum: bla
error.
I have a sqlite file, which only consists of one table foo
with column bar
.
connection = lite.connect(db.sqlite)
def insertEvent(self, bar):
with connection:
cur = connection.cursor()
cur.execute("INSERT INTO foo(bar) VALUES (bar);")
insertEvent("bla")
Is my syntax wrong or why am I getting the error? I couldn't find any useful solutions in all the other questions.
Just in case: I'm using the sqlite3 library.
Upvotes: 0
Views: 1689
Reputation: 12174
Try changing the insert statement to
cur.execute("INSERT INTO foo(bar) VALUES (?);", (bar,))
You aren't using the bar
parameter in the insert statement.
Upvotes: 1