For some reason I am getting errors when using placeholders in select
statements.
def get_id(table_name, id_name):
db = sqlite3.connect('test_db')
max_id = db.execute('''SELECT max(?) FROM ?''', (id_name, table_name)).fetchone()[0]
if not max_id:
primary_id = 0
else:
primary_id = max_id + 1
This functions returns this error:
File "test.py", line 77, in get_id
max_id = db.execute('''SELECT max(?) FROM ?''', (id_name, table_name)).fetchone()[0]
sqlite3.OperationalError: near "?": syntax error