-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 There's a patch attached to http://www.sqlalchemy.org/trac/attachment/ticket/2511/ that does most of it now, in case you want to play with it. Still some glitches need to be ironed out, though.
On Jun 17, 2012, at 9:31 AM, Michael Bayer wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > unfortunately that is the case for now. the event system doesn't actually > have the capability for one class of events to be associated with more than > one type of parent class. it will be a non-trivial task to get both Engine > and Connection to accept the same events, and then to cascade a particular > event across the local connection and then up to the owning engine. ticket > #2511 is added to look into this. > > > > On Jun 17, 2012, at 4:56 AM, Fayaz Yusuf Khan wrote: > >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> This code fails:- >> >> from sqlalchemy import event, create_engine >> >> def before_execute(conn, clauseelement, multiparams, params): >> log.info("Received statement: %s" % clauseelement) >> >> engine = create_engine('mysql://root@localhost') >> connection = engine.connect() >> event.listen(connection, "before_execute", before_execute) >> >> with:- >> >> Traceback (most recent call last): >> File "test.py", line 8, in <module> >> event.listen(connection, "before_execute", before_execute) >> File "/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.7.7-py2.7-linux- >> x86_64.egg/sqlalchemy/event.py", line 40, in listen >> (identifier,target)) >> sqlalchemy.exc.InvalidRequestError: No such event 'before_execute' for >> target '<sqlalchemy.engine.base.Connection object at 0x2a31450>' >> >> - -- >> Fayaz Yusuf Khan >> Cloud architect, Dexetra SS, India >> fayaz.yusuf.khan_AT_gmail_DOT_com, fayaz_AT_dexetra_DOT_com >> +91-9746-830-823 >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v1.4.10 (GNU/Linux) >> >> iQEcBAEBAgAGBQJP3ZvVAAoJEFp5PFlEQdUR6QMIAMyhJuHysLwCwKs3ilQ4HI7e >> 3RaAGIbd3XNoBCekC6knyvHSwkJImkxHxL28UQ4uJTpJtXMRY/YUqZMFiu9Owm7I >> BDyAudzOz/pSe5NkQGnvOxlcR0RFB/qkfDw+xTTGrUDxeGLSpEZfhrJyTkKEktdV >> RJLWba/JLsOq5tw0djxRT2oJ0LNADltVMRo+G8TpB45nRBLEY68exE8Zup/3od3d >> eHyiQQDD7ffz9MUzd+6YktC0vu30LNoj/1XkqzbFeBcZqq8CqkmfM2jQAWUheSlR >> sqiqBzPFDs4a+xxXl2iTlE2Syh1H0zxynhQbd2ldnl04UbZ1HClkDrh51OKcL2M= >> =M31b >> -----END PGP SIGNATURE----- >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sqlalchemy" group. >> To post to this group, send email to sqlalchemy@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. >> > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.11 (Darwin) > Comment: GPGTools - http://gpgtools.org > > iQEcBAEBAgAGBQJP3dwwAAoJEDMCOcHE2v7hOloIAJmvryn9Bys1Qgv25LJ6cYVk > XJ03W4gVY1UPbhvsLgtDlTL0EVYWGrIshNEPgFMmDQ0v+2oxEAP1FTPJIIRbwUVy > D8n1IerxJxN4PVUkeDM7Wobk5TA+BW3086eHr+0znc5e8V4efSfXcyL2VypyEIyi > PxaeoNcN84Nj8fgrq6WFWdFzFukMYYumjMGV9delLw9k7xYPdww1K4v/VyeCL69X > R4FjpYWhOZnkQ10nA+abef+gLA5FVWr5TrzrypaqYV5FpNos0QF0rhx6IrEpI07c > 6qZtbl+UqzJT6UsqqZQp9jVDmPz/QskhaYrZfMlv7LozvwQcaBaIT+3TEWVQ1kU= > =al83 > -----END PGP SIGNATURE----- > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalchemy@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. > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) Comment: GPGTools - http://gpgtools.org iQEcBAEBAgAGBQJP3fz5AAoJEDMCOcHE2v7hYocH/0xbbuWp4Xt9JTn0pTmPAf74 tz0foWUiuFa+Cy0CH8SaLdF2OX0LNEMrOlKATsu0cbvG2lS1rsRnzg90OrZFpvYO 8zd0fMzYmO4xEfeUCyryLtYsIv5Px7h1+WzNlgh1FXSQImjeeReB3hSjBKyNZm39 GJnTPq5r+KwaQMQ3qkeAuhL9XtM5tZpy1ogicVrNH4CnVQ+SU/rP6623g0S4XDwg ZP8s+P1eH+4y/jRJdHpD+HVey/W2DW4op0bMnANcmh1/rG29IQvxMi5C33ngMwpE EO8Ehbpo3dXmGKB6AuryOtsvDwW5JO5ZJnVuGZMgMxi2rZrDwCDo/yH4Q5X9v4k= =NjYg -----END PGP SIGNATURE----- -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@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.