Replies: 2 comments 2 replies
-
the library intentionally doesn't give a way to do this to deter SQL injection. Most dbapis, however, have some kind of cursor.mogrify method that will allow you to view the prepared SQL. Is there a certain dbapi you're trying to use this with? |
Beta Was this translation helpful? Give feedback.
2 replies
-
The tests I'm using in the pydapper suite for the param handler might be useful for you to look at though? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, thanks for an awesome library!
I'm writing some tests for a project which uses
pydapper
, and my idea was to hook intopydapper.connect
and extract the final SQL strings which are sent over ODBC, such that tests could assert that the correct SQL is generated.I'm using objects of this class:
Tests would then use
pytest-mock
to patch theconnect
object in the following way:Usages of the
connect
context manager then ends up using this object, and that's all gravy. However, I can't figure out how to actually get my grubby hands on the interpolated SQL strings; the best I can do is a string in which values are substituted with%s
.Is there any way to do this? Or are there better approaches to this problem?
Thanks a lot!
Beta Was this translation helpful? Give feedback.
All reactions