mxODBC features two styles of statement execution, using the cursor.execute() and cursor.executedirect() methods (the second being an extension to the DBAPI specification). The former makes use of a particular API call specific to the SQL Server Native Client ODBC driver known SQLDescribeParam, while the latter does not.
mxODBC apparently only makes repeated use of a single prepared statement when SQLDescribeParam is used. The advantage to prepared statement reuse is one of performance. The disadvantage is that SQLDescribeParam has a limited set of scenarios in which bind parameters are understood, including that they cannot be placed within the argument lists of function calls, anywhere outside the FROM, or even within subqueries within the FROM clause - making the usage of bind parameters within SELECT statements impossible for all but the most simplistic statements.
For this reason, the mxODBC dialect uses the "native" mode by default only for INSERT, UPDATE, and DELETE statements, and uses the escaped string mode for all other statements.
This behavior can be controlled via
~sqlalchemy.sql.expression.Executable.execution_options
using the
native_odbc_execute flag with a value of True or False, where a
value of True will unconditionally use native bind parameters and a value
of False will unconditionally use string-escaped parameters.
Class | _MSDate_mxodbc |
Undocumented |
Class | _MSNumeric_mxodbc |
Include pyodbc's numeric processor. |
Class | _MSTime_mxodbc |
Undocumented |
Class | _VARBINARY_mxodbc |
mxODBC Support for VARBINARY column types. |
Class | MSDialect_mxodbc |
Undocumented |
Class | MSExecutionContext_mxodbc |
The pyodbc execution context is useful for enabling SELECT SCOPE_IDENTITY in cases where OUTPUT clause does not work (tables with insert triggers). |