From: Michael Trier Date: Tue, 28 Oct 2008 16:48:13 +0000 (+0000) Subject: Mysql no longer expects include_columns to be specified in lowercase. Fixes #1206. X-Git-Tag: rel_0_5rc3~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4dcb2e2176d33d9e7bbee7fe73d34290dbb503e;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Mysql no longer expects include_columns to be specified in lowercase. Fixes #1206. --- diff --git a/CHANGES b/CHANGES index 17f943adea..fbc6963d41 100644 --- 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 diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py index 743ec96ea2..0c22d68813 100644 --- a/lib/sqlalchemy/databases/mysql.py +++ b/lib/sqlalchemy/databases/mysql.py @@ -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 diff --git a/test/dialect/mysql.py b/test/dialect/mysql.py index 6411391678..aca072b4b4 100644 --- a/test/dialect/mysql.py +++ b/test/dialect/mysql.py @@ -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):