summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES5
-rw-r--r--README.unittests5
-rw-r--r--lib/sqlalchemy/dialects/mssql/base.py5
-rw-r--r--lib/sqlalchemy/engine/reflection.py2
-rw-r--r--test/dialect/test_mssql.py7
5 files changed, 19 insertions, 5 deletions
diff --git a/CHANGES b/CHANGES
index 480350fdf..86baaa78a 100644
--- 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
diff --git a/README.unittests b/README.unittests
index ac1b7a18e..9084efb7a 100644
--- a/README.unittests
+++ b/README.unittests
@@ -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
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:
diff --git a/test/dialect/test_mssql.py b/test/dialect/test_mssql.py
index 68f3816a5..b57bc426b 100644
--- a/test/dialect/test_mssql.py
+++ b/test/dialect/test_mssql.py
@@ -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', []),