]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Mysql no longer expects include_columns to be specified in lowercase. Fixes #1206.
authorMichael Trier <mtrier@gmail.com>
Tue, 28 Oct 2008 16:48:13 +0000 (16:48 +0000)
committerMichael Trier <mtrier@gmail.com>
Tue, 28 Oct 2008 16:48:13 +0000 (16:48 +0000)
CHANGES
lib/sqlalchemy/databases/mysql.py
test/dialect/mysql.py

diff --git a/CHANGES b/CHANGES
index 17f943adea838c83ed8c0aeda66d6eb9d28e7549..fbc6963d4152621b34bae643a4fe00131720a71c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -77,6 +77,9 @@ CHANGES
       explicit schema= is the same as the schema (database) the
       connection is attached to.
 
+    - No longer expects include_columns in table reflection to be
+      lower case.
+
 0.5.0rc2
 ========
 - orm
index 743ec96ea249b461807e8faae6a7f190c1f2c6eb..0c22d6881349757cb56a2a64b9a555c2f5965b72 100644 (file)
@@ -2216,7 +2216,7 @@ class MySQLSchemaReflector(object):
         name, type_, args, notnull = \
               spec['name'], spec['coltype'], spec['arg'], spec['notnull']
 
-        if only and name.lower() not in only:
+        if only and name not in only:
             self.logger.info("Omitting reflected column %s.%s" %
                              (table.name, name))
             return
index 641139167828f029bc28cefc16b3296c02ad42d7..aca072b4b415dbd40d6469e84d4e78572f377a15 100644 (file)
@@ -656,6 +656,29 @@ class TypesTest(TestBase, AssertsExecutionResults):
         finally:
             def_table.drop()
 
+    def test_reflection_on_include_columns(self):
+        """Test reflection of include_columns to be sure they respect case."""
+
+        case_table = Table('mysql_case', MetaData(testing.db),
+            Column('c1', String(10)),
+            Column('C2', String(10)),
+            Column('C3', String(10)))
+
+        try:
+            case_table.create()
+            reflected = Table('mysql_case', MetaData(testing.db),
+                              autoload=True, include_columns=['c1', 'C2'])
+            for t in case_table, reflected:
+                assert 'c1' in t.c.keys()
+                assert 'C2' in t.c.keys()
+            reflected2 = Table('mysql_case', MetaData(testing.db),
+                              autoload=True, include_columns=['c1', 'c2'])
+            assert 'c1' in reflected2.c.keys()
+            for c in ['c2', 'C2', 'C3']:
+                assert c not in reflected2.c.keys()
+        finally:
+            case_table.drop()
+
     @testing.exclude('mysql', '<', (5, 0, 0), 'early types are squirrely')
     @testing.uses_deprecated('Using String type with no length')
     def test_type_reflection(self):