]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Remove support for mssql_clustered on Table
authordonkopotamus <derek.harland@finq.co.nz>
Thu, 16 Jan 2014 21:38:31 +0000 (10:38 +1300)
committerdonkopotamus <derek.harland@finq.co.nz>
Thu, 16 Jan 2014 21:38:31 +0000 (10:38 +1300)
lib/sqlalchemy/dialects/mssql/base.py
test/dialect/mssql/test_compiler.py

index a4997d19460ea165f74450a8871de64d4373b05e..213e00d79fa91734ed21fd8f5ff269501dda1542 100644 (file)
@@ -107,8 +107,8 @@ Clustered Index Support
 -----------------------
 
 The MSSQL dialect supports clustered indexes (and primary keys) via the
-``mssql_clustered`` option.  This option is available to :class:`.Index`,
-:class:`.Table` and :class:`.PrimaryKeyConstraint`.
+``mssql_clustered`` option.  This option is available to :class:`.Index`
+and :class:`.PrimaryKeyConstraint`.
 
 To generate a clustered index::
 
@@ -118,14 +118,7 @@ which renders the index as ``CREATE CLUSTERED INDEX my_index ON table (x)``.
 
 .. versionadded:: 0.8
 
-To generate a clustered primary key use either::
-
-    Table('my_table', metadata,
-          Column('x', ..., primary_key=True),
-          Column('y', ..., primary_key=True),
-          mssql_clustered=True)
-
-or::
+To generate a clustered primary key use::
 
     Table('my_table', metadata,
           Column('x', ...),
@@ -1057,11 +1050,8 @@ class MSDDLCompiler(compiler.DDLCompiler):
                     self.preparer.format_constraint(constraint)
         text += "PRIMARY KEY "
 
-        # we allow for mssql_clustered to have been specified directly on a
-        # PrimaryKeyConstraint, or specified upon the table object.  The latter allows
-        # users to tag columns with primary_key=True and still achieve clustering.
-        if (constraint.kwargs.get("mssql_clustered") or
-            constraint.table.kwargs.get("mssql_clustered")):
+        # support clustered option
+        if constraint.kwargs.get("mssql_clustered"):
             text += "CLUSTERED "
 
         text += "(%s)" % ', '.join(self.preparer.quote(c.name)
index 40ca603a024beb268cd873849f933f8ccf0c07ab..f1cf6924cd3f375598180c94d8186a888124ebde 100644 (file)
@@ -510,18 +510,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
                             "CREATE TABLE test (id INTEGER NOT NULL IDENTITY(1,1))"
                             )
 
-    def test_table_pkc_clustering_1(self):
-        metadata = MetaData()
-        tbl = Table('test', metadata,
-                    Column('x', Integer, primary_key=True, autoincrement=False),
-                    Column('y', Integer, primary_key=True, autoincrement=False),
-                    mssql_clustered=True)
-        self.assert_compile(schema.CreateTable(tbl),
-                            "CREATE TABLE test (x INTEGER NOT NULL, y INTEGER NOT NULL, "
-                            "PRIMARY KEY CLUSTERED (x, y))"
-                            )
-
-    def test_table_pkc_clustering_2(self):
+    def test_table_pkc_clustering(self):
         metadata = MetaData()
         tbl = Table('test', metadata,
                     Column('x', Integer, autoincrement=False),