I'm definitely new to SQL but I feel like inserting is pretty simple. I can't figure out the issue
def insert(title, name):
time = datetime.now()
conn = sqlite3.connect('test.db')
c = conn.cursor()
query = """INSERT INTO test ('{}', '{}', '{}')""".format(title, name, time)
c.execute(query)
conn.commit()
When I pass the following:
insert(1, 2)
I get the error:
OperationalError: near "'1'": syntax error
All fields are text if that helps.
Thanks in advance
Aucun commentaire:
Enregistrer un commentaire