diff options
| author | Gord Thompson <gord@gordthompson.com> | 2022-06-14 10:09:04 -0600 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-06-18 13:57:54 -0400 |
| commit | a134956c4e4564844c33302ddf27a70102fe00a8 (patch) | |
| tree | 3a7d9a26c26b58248bb3a366c43e21b14ed05df0 /lib/sqlalchemy/sql/schema.py | |
| parent | 6d889b03dcd42b531001aeec2737949dca41d6d8 (diff) | |
| download | sqlalchemy-a134956c4e4564844c33302ddf27a70102fe00a8.tar.gz | |
Allow NUMERIC()/DECIMAL() IDENTITY columns
Fixed issue where :class:`.Table` objects that made use of IDENTITY columns
with a :class:`.Numeric` datatype would produce errors when attempting to
reconcile the "autoincrement" column, preventing construction of the
:class:`.Column` from using the :paramref:`.Column.autoincrement` parameter
as well as emitting errors when attempting to invoke an :class:`.Insert`
construct.
Fixes: #8111
Change-Id: Iaacc4eebfbafb42fa18f9a1a4f43cb2b6b91d28a
Diffstat (limited to 'lib/sqlalchemy/sql/schema.py')
| -rw-r--r-- | lib/sqlalchemy/sql/schema.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py index c37b60003..2414d9235 100644 --- a/lib/sqlalchemy/sql/schema.py +++ b/lib/sqlalchemy/sql/schema.py @@ -4540,7 +4540,11 @@ class PrimaryKeyConstraint(ColumnCollectionConstraint): def _autoincrement_column(self) -> Optional[Column[Any]]: def _validate_autoinc(col: Column[Any], autoinc_true: bool) -> bool: if col.type._type_affinity is None or not issubclass( - col.type._type_affinity, type_api.INTEGERTYPE._type_affinity + col.type._type_affinity, + ( + type_api.INTEGERTYPE._type_affinity, + type_api.NUMERICTYPE._type_affinity, + ), ): if autoinc_true: raise exc.ArgumentError( |
