Wow, thanks a ton. So if I get you right, I'd register for insert/update/delete events on the engine pointing at the database of interest and then in my callbacks I'd have to first work out the type of the object that was changed and then take appropriate action. Correct? 

If so, this will absolutely solve my problem. 

     E

Sent from my BlackBerry 10 smartphone on the Rogers network.
From: Michael Bayer
Sent: Saturday, January 11, 2014 1:22 PM
Subject: Re: [sqlalchemy] Multiple databases and event.listen?


On Jan 11, 2014, at 1:11 PM, Ed Willis <[email protected]> wrote:

Say I've got more than one database (in my specific example, they're sqlite3 databases).  All the databases have the same table declarations in their schemas.  I want to listen for insert/update/delete events in one specific database and then propagate data from that database to the others.  What I've seen in SQLAlchemy 0.7 (we're a ways back, yes) is that there doesn't seem to be an easy way for me to either filter out the event notifications to just the one databases of interest OTOH or work out which database the data came from when the event is triggered OTO.  

Does anyone know of an easy way to limit event notifications to just one database?

event.listen() accepts an Engine instance, not just a class, as a target:

db1 = create_engine(..)
db2 = create_engine(..)
db3 = create_engine(..)

@event.listens_for(db1, “execute”)
def only_db1_events(…):
  …



hope this helps




Thanks!

--
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.


--
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