Record and replay SQL queries #1221
Unanswered
matthiasschaub
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am experimenting with ways to record and replay SQL queries send by asyncpg (similar to VCR.py).
I do not know the internals of asyncpg well and therefore would appreciate feedback and pointers.
To record and replay, following steps have to be done (roughly):
Step 1
After reading the source code of asyncpg a bit, I decided to wrap the
Connection._execute
function like this:(As context: Below
record
function is intended to be used as decorator around a test function.)Do you find this sensible? Any scenario where this approach would not work?
Step 2
Here I mainly have the following questions:
Which is the best way to mock every possible interaction with the database and create a asyncpg record object from the recorded results?
Any thoughts about any of the points above are highly appreciated. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions