Howdy all,

A bit of a follow up on my previous post.  I'm working on a large project 
with multiple sqlite databases.  We're at SQLAlchemy version 0.7.  On one 
database, in particular, we want to identify when particular tables have 
inserts/updates/deletes done on them and modify a different database when 
these occur.  That's all working fine now.  My problem now is ensuring I 
get *all* such events.  What I've seen in my testing is that if I use the 
orm to do the inserts/deletes/updates, my listeners are called - but if 
core mode is used to modify the same tables, I don't - i.e. (and I 
apologize if I'm not using the terminology correctly):

t = MyTable(...)
session.add(t)
session.commit()

Here I get my insert listener called.

session.execute("insert into MyTable(...) values (...)")
session.commit()

Here I don't.  

Now reading through the docs again more carefully, I think I see now that 
that's expected.  But is there a way to get SQLAlchemy to call me back 
whenever inserts/deletes/updates happen on a given table, regardless of the 
mode used to affect the changes?  The only way I can see is to also 
register for orm events - specifically execute events - and then parse the 
sql to see if it affects the tables of interest.  This prospect overwhelms 
me with trepidation and melancholy :)

Note that revising the code to uniformly use orm would be difficult for us 
- one, the project is large enough that we're unlikely to be able to ensure 
this constraint is maintained in the future, and two, most of the places 
where core mode is used were rewritten from orm usage for performance 
reasons, so teams would likely be very reluctant to revert to orm in such 
cases.  

Thanks very much,

Ed

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to