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
(
column.default.optional
)
):
- if issubclass(type_affinity, sqltypes.BigInteger):
+ if isinstance(impl_type, sqltypes.BigInteger):
colspec += " BIGSERIAL"
else:
colspec += " SERIAL"
__visit_name__ = 'small_integer'
- @property
- def _type_affinity(self):
- return SmallInteger
class BigInteger(Integer):
"""A type for bigger ``int`` integers.
__visit_name__ = 'big_integer'
- @property
- def _type_affinity(self):
- return BigInteger
class Numeric(_DateAffinity, TypeEngine):
"""A type for fixed precision numbers.