I have written a Python script where I update some lines of code in a MySQL database, and I got an error code like this:
raise errors.get_exception(packet)
mysql.connector.errors.ProgrammingError: 1054 (42S22): Unknown column 'dateatime' in 'field list'
the SQL syntax is:
cursor.execute("UPDATE db SET Status = status, Statusänderung_von = dateatime, Priorität = prioritaet WHERE Objekt_ID = %s" % (lineid))
I have tried many things but every time I have the same problem.
All variables like prioritaet
, dateatime
or status
are set before.
could someone help please?
Please try this:
update db
set Status = @status
, Statusänderung_von = @dateatime
, Priorität = @prioritaet
Here is a small DEMO where you can see that without @
you will get the error you have written in your question.