]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
make sure kwargs are copied by tometadata
authorChris Withers <chris@simplistix.co.uk>
Thu, 16 Sep 2010 19:03:18 +0000 (20:03 +0100)
committerChris Withers <chris@simplistix.co.uk>
Thu, 16 Sep 2010 19:03:18 +0000 (20:03 +0100)
lib/sqlalchemy/schema.py
test/engine/test_metadata.py

index 98472f9f118bfa30b46bfeb9b00042ae93a317f6..e61f17d8e9396aafceb634e889b5c6b9aeca3eea 100644 (file)
@@ -478,7 +478,7 @@ class Table(SchemaItem, expression.TableClause):
                 args.append(c.copy(schema=schema))
             for c in self.constraints:
                 args.append(c.copy(schema=schema))
-            return Table(self.name, metadata, schema=schema, *args)
+            return Table(self.name, metadata, schema=schema, *args, **self.kwargs)
 
 class Column(SchemaItem, expression.ColumnClause):
     """Represents a column in a database table."""
index 7ea7536219a04967783a870bbf56ba9791d265a5..5c6f5c1515f7735b9140d51d22cf6cae7eeb74d2 100644 (file)
@@ -246,6 +246,19 @@ class MetaDataTest(TestBase, ComparesTables):
         eq_(str(table_c.join(table2_c).onclause),
             'someschema.mytable.myid = someschema.othertable.myid')
 
+    def test_tometadata_kwargs(self):
+        meta = MetaData()
+
+        table = Table('mytable', meta,
+            Column('myid', Integer, primary_key=True),
+            mysql_engine='InnoDB',
+        )
+
+        meta2 = MetaData()
+        table_c = table.tometadata(meta2)
+
+        eq_(table.kwargs,table_c.kwargs)
+
     def test_tometadata_default_schema(self):
         meta = MetaData()