Commits

Michael Trier committed 9ae821e

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.

Comments (0)

Files changed (5)

       case, so there's no point in having a flag.
     - using new dialect.initialize() feature to set up
       version-dependent behavior.
+    - removed references to sequence which is no longer used.
+      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.
 
 - types
     - The construction of types within dialects has been totally
 
 RUNNING INDIVIDUAL TESTS
 -------------------------
+Any directory of test modules can be run at once by specifying the directory
+path:
+
+    $ nosetest test/dialect
+
 Any test module can be run directly by specifying its module name:
 
     $ nosetests test.orm.test_mapper

lib/sqlalchemy/dialects/mssql/base.py

 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)
 
 
         # 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:

lib/sqlalchemy/engine/reflection.py

                 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:

test/dialect/test_mssql.py

         meta2 = MetaData(testing.db)
         try:
             table2 = Table('identity_test', meta2, autoload=True)
-            assert table2.c['col1'].sequence.start == 2
-            assert table2.c['col1'].sequence.increment == 3
+            sequence = isinstance(table2.c['col1'].default, schema.Sequence) and table2.c['col1'].default
+            assert sequence.start == 2
+            assert sequence.increment == 3
         finally:
             table.drop()
 
             (types.Time, [], {},
              'DATETIME', ['<', (10,)], mssql.MSDateTime),
             (mssql.MSTime, [], {},
-             'DATETIME', ['<', (10,)], mssql.MSDateTime),
+             'TIME', ['>=', (10,)]),
 
             (mssql.MSSmallDateTime, [], {},
              'SMALLDATETIME', []),