summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-02-17 21:05:24 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2011-02-17 21:05:24 -0500
commitd8117b3aa29d28c84f09770906fbd930927e8e2a (patch)
treef2dfa0f6f378d1d36b71a06581279f6d7c2bffee
parent07628e84785b5c0e30bfe974c36c8469e1794336 (diff)
downloadsqlalchemy-d8117b3aa29d28c84f09770906fbd930927e8e2a.tar.gz
-adjust the fix for [ticket:2065] to not rely upon type affinity, revert
the _type_affinity attribute of SmallInteger, BigInteger
-rw-r--r--lib/sqlalchemy/dialects/postgresql/base.py6
-rw-r--r--lib/sqlalchemy/types.py6
2 files changed, 3 insertions, 9 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py
index 8bc95ef48..b6a6357b5 100644
--- a/lib/sqlalchemy/dialects/postgresql/base.py
+++ b/lib/sqlalchemy/dialects/postgresql/base.py
@@ -505,10 +505,10 @@ class PGCompiler(compiler.SQLCompiler):
class PGDDLCompiler(compiler.DDLCompiler):
def get_column_specification(self, column, **kwargs):
colspec = self.preparer.format_column(column)
- type_affinity = column.type._type_affinity
+ impl_type = column.type.dialect_impl(self.dialect)
if column.primary_key and \
column is column.table._autoincrement_column and \
- not issubclass(type_affinity, sqltypes.SmallInteger) and \
+ not isinstance(impl_type, sqltypes.SmallInteger) and \
(
column.default is None or
(
@@ -516,7 +516,7 @@ class PGDDLCompiler(compiler.DDLCompiler):
column.default.optional
)
):
- if issubclass(type_affinity, sqltypes.BigInteger):
+ if isinstance(impl_type, sqltypes.BigInteger):
colspec += " BIGSERIAL"
else:
colspec += " SERIAL"
diff --git a/lib/sqlalchemy/types.py b/lib/sqlalchemy/types.py
index 71b55f33f..d25fa3070 100644
--- a/lib/sqlalchemy/types.py
+++ b/lib/sqlalchemy/types.py
@@ -1007,9 +1007,6 @@ class SmallInteger(Integer):
__visit_name__ = 'small_integer'
- @property
- def _type_affinity(self):
- return SmallInteger
class BigInteger(Integer):
"""A type for bigger ``int`` integers.
@@ -1021,9 +1018,6 @@ class BigInteger(Integer):
__visit_name__ = 'big_integer'
- @property
- def _type_affinity(self):
- return BigInteger
class Numeric(_DateAffinity, TypeEngine):
"""A type for fixed precision numbers.