Hi all.

I just stumbled across an after_attach event handler in my code. That
handler used to replace a None reference with a persistent instance that
was already loaded.

After a few changes, it ended up doing a query to load that instance. It
seems this messes up the session state, which caused a query to change
from

INSERT INTO group_items (group_id, item_id, item_order) VALUES (?, ?, ?)
(242, 244, 0)

into the less usefull

INSERT INTO group_items (group_id, item_id, item_order) VALUES (?, ?, ?)
(None, None, None)

Both the group and the item where created correctly so I ended up with a
database which has all the data, just missing their relationships ;-)


I reverted to running the query when first connecting to the database.
What I would like to know: Is it officially impossible to run queries
from session events? What session functionality is usable from within
session events? (I know that session.{dirty, new, deleted} works fine).

Thanks and happy holidays,

Torsten

-- 
DYNAmore Gesellschaft fuer Ingenieurdienstleistungen mbH
Torsten Landschoff

Office Dresden
Tel: +49-(0)351-4519587
Fax: +49-(0)351-4519561

mailto:torsten.landsch...@dynamore.de
http://www.dynamore.de

Registration court: Mannheim, HRB: 109659, based in Karlsruhe,
Managing director:  Prof. Dr. K. Schweizerhof, Dipl.-Math. U. Franz

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to