Skip to content
Advertisement

String of cursor.execute without executing

I am using the following approach to using pymysql to parametrize the SQL+args query but not execute it (legitimately, at least):

Is there actually a method that pymysql has where it just formats the SQL string without executing it, or do I need to use something like the above? Or, another option:

Advertisement

Answer

The cursor.mogrify method

Returns the exact string that is sent to the database by calling the execute() method.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement