diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-12-30 13:56:20 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-12-30 15:06:34 -0500 |
commit | 102b91d8950926f1215dd7c59c5b7f200b5c0f8b (patch) | |
tree | cd956c6a250f5a9602f094d1820085187e3bf743 /lib/sqlalchemy/sql/compiler.py | |
parent | e8507b21ec5e4420fbb6f0df8a14ee33501e26cd (diff) | |
download | sqlalchemy-102b91d8950926f1215dd7c59c5b7f200b5c0f8b.tar.gz |
Support TypeDecorator.get_dbapi_type() for setinpusizes
Adjusted the "setinputsizes" logic relied upon by the cx_Oracle, asyncpg
and pg8000 dialects to support a :class:`.TypeDecorator` that includes
an override the :meth:`.TypeDecorator.get_dbapi_type()` method.
Change-Id: I5aa70abf0d9a9e2ca43309f2dd80b3fcd83881b9
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index a734bb582..8ee575cca 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -1047,14 +1047,19 @@ class SQLCompiler(Compiled): if include_types is None and exclude_types is None: def _lookup_type(typ): - dialect_impl = typ._unwrapped_dialect_impl(dialect) - return dialect_impl.get_dbapi_type(dbapi) + dbtype = typ.dialect_impl(dialect).get_dbapi_type(dbapi) + return dbtype else: def _lookup_type(typ): + # note we get dbtype from the possibly TypeDecorator-wrapped + # dialect_impl, but the dialect_impl itself that we use for + # include/exclude is the unwrapped version. + dialect_impl = typ._unwrapped_dialect_impl(dialect) - dbtype = dialect_impl.get_dbapi_type(dbapi) + + dbtype = typ.dialect_impl(dialect).get_dbapi_type(dbapi) if ( dbtype is not None |