Home > OS >  sqlite3.OperationalError: near ":59": syntax error
sqlite3.OperationalError: near ":59": syntax error

Time:10-21

I'm trying to update my database. I want to change None to time and while I'm running it

sqlite3.OperationalError: near ":59": syntax error

my code to update is :

    now = datetime.now()
    trigger_time = str(now.strftime("%H:%M"))
    db.execute(f"""Update Signals set Triger_Time = {trigger_time} where ID = {int(signal_id)}""")

SOLVED BY (https://stackoverflow.com/a/69661333/16613629)

Answer : You forget about quotes around Triger_Time:

now = datetime.now()
trigger_time = str(now.strftime("%H:%M"))
db.execute(f"""Update Signals set Triger_Time = '{trigger_time}' where ID = {int(signal_id)}""")

CodePudding user response:

You forget about quotes around Triger_Time:

now = datetime.now()
trigger_time = str(now.strftime("%H:%M"))
db.execute(f"""Update Signals set Triger_Time = '{trigger_time}' where ID = {int(signal_id)}""")
  • Related