]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
MSSQL Dialect should set sequence columns to be non null
authorDerek Harland <derek.harland@finq.co.nz>
Tue, 4 Dec 2012 01:48:37 +0000 (14:48 +1300)
committerDerek Harland <derek.harland@finq.co.nz>
Tue, 4 Dec 2012 01:48:37 +0000 (14:48 +1300)
lib/sqlalchemy/dialects/mssql/base.py

index 0f862f10bb4b802606e9466baf68a2ee3b921a6f..127e5da797ab2f10648c44c07c281c82ba45988a 100644 (file)
@@ -1018,7 +1018,8 @@ class MSDDLCompiler(compiler.DDLCompiler):
                    + self.dialect.type_compiler.process(column.type))
 
         if column.nullable is not None:
-            if not column.nullable or column.primary_key:
+            if not column.nullable or column.primary_key or \
+                    isinstance(column.default, sa_schema.Sequence):
                 colspec += " NOT NULL"
             else:
                 colspec += " NULL"