I'd like to measure the number of database round trips that are associated with a request to my web application so I can write tests to catch potential performance regressions. I've been using mock.Mock(wraps=connection.execute) to keep count and while I think this works for selects, I don't have a good understanding of when executed statements result in serialised network round trips or when they can be 'pipelined', e.g. when inserting new rows.
So to take a real example, posting to my web app results in the insertion of a row in each of four tables. Afterwards, the connection.execute mock's call_count is 4 and I see 4 INSERTs in my sqlalchemy log: INFO:sqlalchemy.engine.base.Engine:INSERT INTO resources (rid) VALUES (?) INFO:sqlalchemy.engine.base.Engine:('7745b647ff154ff39cedb897d4e2983c',) INFO:sqlalchemy.engine.base.Engine:INSERT INTO statements (rid, predicate, object, tid) VALUES (?, ?, ?, ?) INFO:sqlalchemy.engine.base.Engine:('7745b647ff154ff39cedb897d4e2983c', 'organism', '{"scientific_name": "Homo sapiens", "taxon_id": 9606, "_uuid": "7745b647-ff15-4ff3-9ced-b897d4e2983c", "organism_name": "human"}', 'edea69795dd14eb6bed73321cff54471') INFO:sqlalchemy.engine.base.Engine:INSERT INTO transactions (tid, data) VALUES (?, ?) INFO:sqlalchemy.engine.base.Engine:('edea69795dd14eb6bed73321cff54471', '{"tid": "edea6979-5dd1-4eb6-bed7-3321cff54471", "description": "/organisms/", "user": " remoteuser:TEST"}') INFO:sqlalchemy.engine.base.Engine:INSERT INTO current_statements (rid, predicate, sid) VALUES (?, ?, ?) INFO:sqlalchemy.engine.base.Engine:('7745b647ff154ff39cedb897d4e2983c', 'organism', 1) Is there some way to tell which statements end up having data read from the cursor? Here I have one dependent insert which required the autoincremented primary key from a related row whereas the rest were fully specified. Laurence -- 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 http://groups.google.com/group/sqlalchemy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.