diff options
| author | Michael Trier <mtrier@gmail.com> | 2009-10-22 03:29:52 +0000 |
|---|---|---|
| committer | Michael Trier <mtrier@gmail.com> | 2009-10-22 03:29:52 +0000 |
| commit | 9ae821ee660a2d03cae591798c05cfdbd8bb3ca6 (patch) | |
| tree | 09eb87753606f7a0839c7cce8b104934b9dbc7f8 /lib | |
| parent | e552ce339e9ee4fe2c8adf2298d7bba94ba817ac (diff) | |
| download | sqlalchemy-9ae821ee660a2d03cae591798c05cfdbd8bb3ca6.tar.gz | |
Removed references to sequence in MSSQL
Implicit identities in mssql work the same as implicit sequences on any
other dialects. Explicit sequences are enabled through the use of
"default=Sequence()". See the MSSQL dialect documentation for more
information.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sqlalchemy/dialects/mssql/base.py | 5 | ||||
| -rw-r--r-- | lib/sqlalchemy/engine/reflection.py | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py index 76846b6b4..ae9834a39 100644 --- a/lib/sqlalchemy/dialects/mssql/base.py +++ b/lib/sqlalchemy/dialects/mssql/base.py @@ -138,6 +138,9 @@ would yield:: Note that the ``start`` and ``increment`` values for sequences are optional and will default to 1,1. +Implicit ``autoincrement`` behavior works the same in MSSQL as it +does in other dialects and results in an ``IDENTITY`` column. + * Support for ``SET IDENTITY_INSERT ON`` mode (automagic on / off for ``INSERT`` s) @@ -1082,7 +1085,7 @@ class MSDDLCompiler(compiler.DDLCompiler): # install a IDENTITY Sequence if we have an implicit IDENTITY column if seq_col is column: - sequence = getattr(column, 'sequence', None) + sequence = isinstance(column.default, sa_schema.Sequence) and column.default if sequence: start, increment = sequence.start or 1, sequence.increment or 1 else: diff --git a/lib/sqlalchemy/engine/reflection.py b/lib/sqlalchemy/engine/reflection.py index d88a0a3d2..0bd1e955d 100644 --- a/lib/sqlalchemy/engine/reflection.py +++ b/lib/sqlalchemy/engine/reflection.py @@ -300,7 +300,7 @@ class Inspector(object): colargs.append(sa_schema.DefaultClause(sql.text(col_d['default']))) if 'sequence' in col_d: - # TODO: whos using this ? + # TODO: mssql, maxdb and sybase are using this. seq = col_d['sequence'] sequence = sa_schema.Sequence(seq['name'], 1, 1) if 'start' in seq: |
