summaryrefslogtreecommitdiff
path: root/test/dialect/mysql.py
diff options
context:
space:
mode:
authorJason Kirtland <jek@discorporate.us>2007-08-28 23:44:00 +0000
committerJason Kirtland <jek@discorporate.us>2007-08-28 23:44:00 +0000
commit731dd1e96f7f428efca8cd5df46af092ead7a7e0 (patch)
tree5d9fba1f5e1a0a7f2f02ad96a90af0443a249c2e /test/dialect/mysql.py
parentb11fde9cff282de6ab6940782af593da2bda7791 (diff)
downloadsqlalchemy-731dd1e96f7f428efca8cd5df46af092ead7a7e0.tar.gz
- Restored reflection for mysql VIEWs [ticket:748]
- Fixed anonymous pk reflection for mysql 5.1 - Tested table and view reflection against the 'sakila' database from MySQL AB on 3.23 - 6.0. (with some schema adjustments, obviously) Maybe this will go into the SA test suite someday. - Tweaked mysql server version tuplification, now also splitting on hyphens - Light janitorial
Diffstat (limited to 'test/dialect/mysql.py')
-rw-r--r--test/dialect/mysql.py38
1 files changed, 28 insertions, 10 deletions
diff --git a/test/dialect/mysql.py b/test/dialect/mysql.py
index 7e0a55474..1cf6b437c 100644
--- a/test/dialect/mysql.py
+++ b/test/dialect/mysql.py
@@ -587,19 +587,37 @@ class TypesTest(AssertMixin):
columns = [Column('c%i' % (i + 1), t[0]) for i, t in enumerate(specs)]
- m = MetaData(testbase.db)
+ db = testbase.db
+ m = MetaData(db)
t_table = Table('mysql_types', m, *columns)
- m.drop_all()
- m.create_all()
+ try:
+ m.create_all()
- m2 = MetaData(testbase.db)
- rt = Table('mysql_types', m2, autoload=True)
-
- expected = [len(c) > 1 and c[1] or c[0] for c in specs]
- for i, reflected in enumerate(rt.c):
- assert isinstance(reflected.type, type(expected[i]))
+ m2 = MetaData(db)
+ rt = Table('mysql_types', m2, autoload=True)
+ try:
+ db.execute('CREATE OR REPLACE VIEW mysql_types_v '
+ 'AS SELECT * from mysql_types')
+ rv = Table('mysql_types_v', m2, autoload=True)
+
+ expected = [len(c) > 1 and c[1] or c[0] for c in specs]
+
+ # Early 5.0 releases seem to report more "general" for columns
+ # in a view, e.g. char -> varchar, tinyblob -> mediumblob
+ #
+ # Not sure exactly which point version has the fix.
+ if db.dialect.server_version_info(db.connect()) < (5, 0, 11):
+ tables = rt,
+ else:
+ tables = rt, rv
- m.drop_all()
+ for table in tables:
+ for i, reflected in enumerate(table.c):
+ assert isinstance(reflected.type, type(expected[i]))
+ finally:
+ db.execute('DROP VIEW mysql_types_v')
+ finally:
+ m.drop_all()
@testing.supported('mysql')
def test_autoincrement(self):