On Wed, Mar 16, 2016 at 1:43 PM, Piotr Dobrogost <p...@2016.groups.google.dobrogost.net> wrote:Hi!
When executing below code
DBSession.query(TextValue).\
filter(Node.id.in_(ids)).\
update({TextValue.value: appstruct['text_value']},
synchronize_session=False)
I get this error:
OperationalError: (sqlite3.OperationalError) near "FROM": syntax error [SQL: u'UPDATE text_values SET value=? FROM nodes WHERE nodes.id IN (?, ?, ?, ?)'] [parameters: (u'zzz', u'1685', u'175', u'1688', u'180')]
I'm not sure if sqlite supports multi-table updates. Do you know what sort of SQL you are expecting to generate here?
(Note that your query appears at least to be missing a join condition between the TextValue and Node classes)
Hi!
When executing below code
DBSession.query(TextValue).\
filter(Node.id.in_(ids)).\
update({TextValue.value: appstruct['text_value']},
synchronize_session=False)
I get this error:
OperationalError: (sqlite3.OperationalError) near "FROM": syntax error [SQL: u'UPDATE text_values SET value=? FROM nodes WHERE nodes.id IN (?, ?, ?, ?)'] [parameters: (u'zzz', u'1685', u'175', u'1688', u'180')]
Hmm, ok. In that case, does it work if you use "TextValue.id.in_(ids)" rather than Node? I can't tell from your
description if the "id" and "value" columns are both present on the TextValue table, or if you actually need to join to the Node class.
It does seem like a bug that SA is generating this SQL.