Skip to content
Advertisement

SQL Update statement: OperationalError near “FROM”

Replacing box = with tb.box = shifts the error to the ‘.’:

Error:

Advertisement

Answer

Actual implementation may not be fully adhered even with latest SQLite to support UPDATE-FROM. Specifically, docs do not indicate:

  • JOIN in outer query is supported in UPDATE.
  • FROM table should not repeat table in UPDATE.
  • Table alias alone in UPDATE may not be allowed. Possibly no alias for updated table should be used.

Consider below adjustment aligned to example in docs. Below demonstrates parameterization with sqlite3 raw cursor. Adjust to however you run with sqlalchemy.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement