My problem is not where to store the mogrified query, I can just replace the sql sent with the response to saving the data with the mogrified one. In order to produce the mogrified query in the first place I need a psycopg2.cursor object, but I only have access to a Connection object (the wrapper, not the actual psycopg2.connection object). Should I modify that wrapper Connection class to add a mogirfy function? or just get a cursor using the psycopg2.connection object like this: conn.conn.cursor() - which doesn't seem right. Thoughts?
That would be the way. But I think web/pgadmin/utils/driver/psycopg2/cursor.py will be corrrect place to add the mogrify function. Please note, psycopg2 does not support (,),% in the parameter names. So if the column names has any of these characters, mogrify might fail. Although it is handled with pgadmin_alias (line 493 - web/pgadmin/tools/sqleditor/__init__.py), please test this case as well.
The cursor wrapper class (DictCursor) is exclusively used by the connection wrapper class (at web/pgadmin/utils/driver/psycopg2/connection.py) as a cursor factory. I think the mogrify function will need to be implemented in both classes, as the Connection class is the one that is used throughout the code - no code uses cursors directly. What do you think?
The use of cursor.query will not be possible as this is a property of the cursor, not the connection. I will need to call cursor.query on the exact cursor that was used to execute the query, which is not accessible in this case.
Thanks a lot for your help !
Also, could you please help me with the selenium TimeoutException in the feature tests? 3 tests are failing because of that exception and I am not sure what is it related to. I am attaching the feature test log file in this email if you would like to take a look on it.
Can you check on latest chrome and chromdriver. You can check the chromedriver version as below. Your venv should have the chromedriver binary.