]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Removed references to sequence in MSSQL
authorMichael Trier <mtrier@gmail.com>
Thu, 22 Oct 2009 03:29:52 +0000 (03:29 +0000)
committerMichael Trier <mtrier@gmail.com>
Thu, 22 Oct 2009 03:29:52 +0000 (03:29 +0000)
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.

CHANGES
README.unittests
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/engine/reflection.py
test/dialect/test_mssql.py

diff --git a/CHANGES b/CHANGES
index 480350fdf2065f02077489bc203c845e72ac684b..86baaa78a48f6cad2723e877b4a885f8ddb8afd7 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -519,6 +519,11 @@ CHANGES
       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
index ac1b7a18e6825490160304ab45f6685c5f71d07b..9084efb7aabb03793a952cf00ca676e05646398c 100644 (file)
@@ -50,6 +50,11 @@ intersesting:
 
 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
index 76846b6b437b0fb9278cd672d8899f56795b51a4..ae9834a3934779ee1515a8a1f170bb256cc025e2 100644 (file)
@@ -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:
index d88a0a3d29341ad26f482378bbce3ecde329f56f..0bd1e955d029a172e97e594ac0379710b3a0a352 100644 (file)
@@ -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:
index 68f3816a5657c3b6d4cc07b98ff7b737550971b2..b57bc426b81c6057b396d9d192ed815a58e21405 100644 (file)
@@ -322,8 +322,9 @@ class ReflectionTest(TestBase, ComparesTables):
         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()
 
@@ -799,7 +800,7 @@ class TypesTest(TestBase, AssertsExecutionResults, ComparesTables):
             (types.Time, [], {},
              'DATETIME', ['<', (10,)], mssql.MSDateTime),
             (mssql.MSTime, [], {},
-             'DATETIME', ['<', (10,)], mssql.MSDateTime),
+             'TIME', ['>=', (10,)]),
 
             (mssql.MSSmallDateTime, [], {},
              'SMALLDATETIME', []),