On Jan 26, 2012, at 8:26 PM, Mason wrote:
> Hi,
>
> I have some problem understanding this error. From googling around,
> this is about modifying data on more than 1 table, so the ORM wouldn't
> do it. However, my query is
>
> self.session.query(e).filter(e.src_id == src_id).filter(e.tar_id ==
> tar_id).update({e.status: self._DELETE})
>
> and it only involve 1 table. From debug, without the update part, the
> select is translated to
>
> SELECT events_1.event_id AS events_1_event_id, events_1.src_id AS
> events_1_src_id, events_1.tar_id AS events_1_tar_id, events_1.type AS
> events_1_type, events_1.event_ts AS events_1_event_ts, events_1.status
> AS events_1_status, events_1.media_id AS events_1_media_id FROM events
> AS events_1 WHERE events_1.src_id = :src_id_1 AND events_1.tar_id
> = :tar_id_1
>
> It looks very simple, what am I missing?
The message there suggests "e" is mapped to more than one table, typically the
"child" table in a joined table inheritance setup. If both of e.src_id
and e.tar_id are local to the "events" table, 0.8 has plans to support
considering just "local_table" within query.update(), in ticket #2365:
http://www.sqlalchemy.org/trac/ticket/2365. There's a one line patch there
now that opens things up for update() but further testing is needed to roll it
out.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.