I'm writing an end-to-end regression test for a program that uses SQLAlchemy over psycopg2, as well as psycopg2 directly, to make a set of changes to a database. To test that the program is correct, my plan is to run it with instrumentation that collects the final set of database queries it would ultimately execute, and compare that set to a verified baseline.
Therefore I'm looking for a way to collect that set of changes in any sort of regular, consistent textual format. If SQLAlchemy has some sort of normalized, engine-neutral precursors of the ultimate SQL statements, then that would be the best. Failing that, the SQL statements themselves would work, as long as they are consistent.
What's the way to accomplish this with SQLAlchemy and/or psycopg2?
Ideally I would like a solution that works with both statements executed by SQLAlchemy and statements executed directly by psycopg2, as we do call cursor.execute()
directly in some cases.
Aucun commentaire:
Enregistrer un commentaire