summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-10-15 18:18:03 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2020-10-16 14:28:04 -0400
commit87c24c498cb660e7a8d7d4dd5f630b967f79d3c8 (patch)
tree06f1113c0db30fb1471ac74e69af5a67976b1246 /lib/sqlalchemy/sql/compiler.py
parent41d3e16773e84692b6625ccb67da204b5362d9c3 (diff)
downloadsqlalchemy-87c24c498cb660e7a8d7d4dd5f630b967f79d3c8.tar.gz
Genericize setinputsizes and support pyodbc
Reworked the "setinputsizes()" set of dialect hooks to be correctly extensible for any arbirary DBAPI, by allowing dialects individual hooks that may invoke cursor.setinputsizes() in the appropriate style for that DBAPI. In particular this is intended to support pyodbc's style of usage which is fundamentally different from that of cx_Oracle. Added support for pyodbc. Fixes: #5649 Change-Id: I9f1794f8368bf3663a286932cfe3992dae244a10
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r--lib/sqlalchemy/sql/compiler.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 2fa9961eb..23cd778d0 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -971,7 +971,7 @@ class SQLCompiler(Compiled):
@util.memoized_instancemethod
def _get_set_input_sizes_lookup(
- self, translate=None, include_types=None, exclude_types=None
+ self, include_types=None, exclude_types=None
):
if not hasattr(self, "bind_names"):
return None
@@ -986,7 +986,7 @@ class SQLCompiler(Compiled):
# for a dialect impl, also subclass Emulated first which overrides
# this behavior in those cases to behave like the default.
- if not include_types and not exclude_types:
+ if include_types is None and exclude_types is None:
def _lookup_type(typ):
dialect_impl = typ._unwrapped_dialect_impl(dialect)
@@ -1001,12 +1001,12 @@ class SQLCompiler(Compiled):
if (
dbtype is not None
and (
- not exclude_types
+ exclude_types is None
or dbtype not in exclude_types
and type(dialect_impl) not in exclude_types
)
and (
- not include_types
+ include_types is None
or dbtype in include_types
or type(dialect_impl) in include_types
)