Now rendering of a DECLARE clause happens in the Cursor.execute, which is bad because of the following.
At the execution stage the information about the bound variable is incomplete, it impossible to use powerful SQLAlchemy type engine, so we able only guess about the bound variable type by the value.
It becomes harder to change the Cursor implementation, because you have to implement the DECLARE rendering again.
It is impossible to use SQLAlchemy caching of rendered queries, because the query becomes completely rendered right before the execution.
Suggested solution
Move rendering of a DECLARE clause to the Compilation stage, use information about the table and SQLAlchemy Type engine to determine types.
Workaround
It's impossible to render the DECLARE clause at the Compilation stage, because of "postcompile" variables. Instead it is possible to determine types of the bound variables right before the execution and pass it to the DataQuery.
Results
All tests are passed, even those that were previously failed.
Problem
Now rendering of a DECLARE clause happens in the
Cursor.execute
, which is bad because of the following.Suggested solution
Move rendering of a DECLARE clause to the Compilation stage, use information about the table and SQLAlchemy Type engine to determine types.
Workaround
It's impossible to render the DECLARE clause at the Compilation stage, because of "postcompile" variables. Instead it is possible to determine types of the bound variables right before the execution and pass it to the DataQuery.
Results
All tests are passed, even those that were previously failed.