On 05/10/2017 07:55 PM, Jonathan Vanasco wrote:
I have a few basic questions on the "transactional" events as I try to extend pyramid's logging system to grab them.

1. do the events need to return anything, or can they just sit there and be dumb?

for example:

     @event.listens_for(Engine, "commit")
     def _commit(conn):
        pass

some frameworks have listeners where a return value is required for things to pass/fail. the sqlalchemy docs didn't note anything, so i want to be sure they can be dumb.


no return value needed

2. is there a way to time these? a `commit` can trigger many deferred foreign key checks, which could take a while. i don't see an apparent way to time this.

i don't need to time anything. the library is full featured though, and most times i think a function doesn't exist, it does -- but i missed it in the docs.

i have a feeling that its not possible to time a `commit`, because it would add a bunch of cruft for a weird use-case that 2 people would use. it seems worth asking about though.

you mean, the commit() method itself how long does that take? You'd probably do a time.time() check before and after calling the method (or use timeit.timeit to do the same).




--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description.
---
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 sqlalchemy+unsubscr...@googlegroups.com <mailto:sqlalchemy+unsubscr...@googlegroups.com>. To post to this group, send email to sqlalchemy@googlegroups.com <mailto:sqlalchemy@googlegroups.com>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to