On Wednesday, March 16, 2016 at 2:43:06 PM UTC+1, Piotr Dobrogost 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')]
>
Changing Node.id.in_(ids) to TextValue.id.in_(ids) results in expected and
much simpler SQL which is executed without problems:
UPDATE text_values SET value=? WHERE text_values.id IN (?, ?, ?, ?)
(u'zzz', u'1685', u'175', u'1688', u'180')
I used Node.id here as I'm using this for simple selects like this:
first_text = DBSession.query(TextValue).filter(Node.id == ids[0]).one()
without any problems so I thought I can use the same in update. Apparently
I can't and I would like to know what makes it invalid when used in update.
Regards,
Piotr Dobrogost
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.