From 92534dc8f30d173deaa1221a6872fd9b7ceae325 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 14 Oct 2013 16:12:54 -0400 Subject: The MySQL :class:`.mysql.SET` type now features the same auto-quoting behavior as that of :class:`.mysql.ENUM`. Quotes are not required when setting up the value, but quotes that are present will be auto-detected along with a warning. This also helps with Alembic where the SET type doesn't render with quotes. [ticket:2817] --- test/dialect/mysql/test_reflection.py | 54 +++++++++++++++++------------------ 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'test/dialect/mysql/test_reflection.py') diff --git a/test/dialect/mysql/test_reflection.py b/test/dialect/mysql/test_reflection.py index b9e347d41..cac613d5d 100644 --- a/test/dialect/mysql/test_reflection.py +++ b/test/dialect/mysql/test_reflection.py @@ -140,33 +140,33 @@ class ReflectionTest(fixtures.TestBase, AssertsExecutionResults): @testing.uses_deprecated('Manually quoting ENUM value literals') def test_type_reflection(self): # (ask_for, roundtripped_as_if_different) - specs = [( String(1), mysql.MSString(1), ), - ( String(3), mysql.MSString(3), ), - ( Text(), mysql.MSText(), ), - ( Unicode(1), mysql.MSString(1), ), - ( Unicode(3), mysql.MSString(3), ), - ( UnicodeText(), mysql.MSText(), ), - ( mysql.MSChar(1), ), - ( mysql.MSChar(3), ), - ( NCHAR(2), mysql.MSChar(2), ), - ( mysql.MSNChar(2), mysql.MSChar(2), ), # N is CREATE only - ( mysql.MSNVarChar(22), mysql.MSString(22), ), - ( SmallInteger(), mysql.MSSmallInteger(), ), - ( SmallInteger(), mysql.MSSmallInteger(4), ), - ( mysql.MSSmallInteger(), ), - ( mysql.MSSmallInteger(4), mysql.MSSmallInteger(4), ), - ( mysql.MSMediumInteger(), mysql.MSMediumInteger(), ), - ( mysql.MSMediumInteger(8), mysql.MSMediumInteger(8), ), - ( LargeBinary(3), mysql.TINYBLOB(), ), - ( LargeBinary(), mysql.BLOB() ), - ( mysql.MSBinary(3), mysql.MSBinary(3), ), - ( mysql.MSVarBinary(3),), - ( mysql.MSTinyBlob(),), - ( mysql.MSBlob(),), - ( mysql.MSBlob(1234), mysql.MSBlob()), - ( mysql.MSMediumBlob(),), - ( mysql.MSLongBlob(),), - ( mysql.ENUM("''","'fleem'"), ), + specs = [(String(1), mysql.MSString(1), ), + (String(3), mysql.MSString(3), ), + (Text(), mysql.MSText(), ), + (Unicode(1), mysql.MSString(1), ), + (Unicode(3), mysql.MSString(3), ), + (UnicodeText(), mysql.MSText(), ), + (mysql.MSChar(1), ), + (mysql.MSChar(3), ), + (NCHAR(2), mysql.MSChar(2), ), + (mysql.MSNChar(2), mysql.MSChar(2), ), # N is CREATE only + (mysql.MSNVarChar(22), mysql.MSString(22), ), + (SmallInteger(), mysql.MSSmallInteger(), ), + (SmallInteger(), mysql.MSSmallInteger(4), ), + (mysql.MSSmallInteger(), ), + (mysql.MSSmallInteger(4), mysql.MSSmallInteger(4), ), + (mysql.MSMediumInteger(), mysql.MSMediumInteger(), ), + (mysql.MSMediumInteger(8), mysql.MSMediumInteger(8), ), + (LargeBinary(3), mysql.TINYBLOB(), ), + (LargeBinary(), mysql.BLOB() ), + (mysql.MSBinary(3), mysql.MSBinary(3), ), + (mysql.MSVarBinary(3),), + (mysql.MSTinyBlob(),), + (mysql.MSBlob(),), + (mysql.MSBlob(1234), mysql.MSBlob()), + (mysql.MSMediumBlob(),), + (mysql.MSLongBlob(),), + (mysql.ENUM("''","'fleem'"), ), ] columns = [Column('c%i' % (i + 1), t[0]) for i, t in enumerate(specs)] -- cgit v1.2.1 From 51e8e5df469b755ad8ba940a43281e8423789167 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 25 Oct 2013 17:18:40 -0400 Subject: - Fix and test parsing of MySQL foreign key options within reflection; this complements the work in :ticket:`2183` where we begin to support reflection of foreign key options such as ON UPDATE/ON DELETE cascade. [ticket:2839] --- test/dialect/mysql/test_reflection.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/dialect/mysql/test_reflection.py') diff --git a/test/dialect/mysql/test_reflection.py b/test/dialect/mysql/test_reflection.py index cac613d5d..7494eaf43 100644 --- a/test/dialect/mysql/test_reflection.py +++ b/test/dialect/mysql/test_reflection.py @@ -298,3 +298,22 @@ class RawReflectionTest(fixtures.TestBase): assert regex.match(' PRIMARY KEY USING BTREE (`id`)') assert regex.match(' PRIMARY KEY (`id`) USING BTREE') + def test_fk_reflection(self): + regex = self.parser._re_constraint + + m = regex.match(' CONSTRAINT `addresses_user_id_fkey` ' + 'FOREIGN KEY (`user_id`) ' + 'REFERENCES `users` (`id`) ' + 'ON DELETE CASCADE ON UPDATE CASCADE') + eq_(m.groups(), ('addresses_user_id_fkey', '`user_id`', + '`users`', '`id`', None, 'CASCADE', 'CASCADE')) + + + m = regex.match(' CONSTRAINT `addresses_user_id_fkey` ' + 'FOREIGN KEY (`user_id`) ' + 'REFERENCES `users` (`id`) ' + 'ON DELETE CASCADE ON UPDATE SET NULL') + eq_(m.groups(), ('addresses_user_id_fkey', '`user_id`', + '`users`', '`id`', None, 'CASCADE', 'SET NULL')) + + -- cgit v1.2.1