diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-06-03 18:33:20 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-06-03 18:33:20 -0400 |
commit | ada19275299f0105f4aaed5bbe0d373ea33feea6 (patch) | |
tree | effc1e3d25f4c94512a19720dacbae1d8270f0d5 /test/dialect/test_mysql.py | |
parent | 3a13047fb06d698e0440895281c484199e0a95a5 (diff) | |
download | sqlalchemy-ada19275299f0105f4aaed5bbe0d373ea33feea6.tar.gz |
The ``deferrable`` keyword argument on :class:`.ForeignKey` and
:class:`.ForeignKeyConstraint` will not render the ``DEFERRABLE`` keyword
on the MySQL dialect. For a long time we left this in place because
a non-deferrable foreign key would act very differently than a deferrable
one, but some environments just disable FKs on MySQL, so we'll be less
opinionated here. [ticket:2721]
Diffstat (limited to 'test/dialect/test_mysql.py')
-rw-r--r-- | test/dialect/test_mysql.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/dialect/test_mysql.py b/test/dialect/test_mysql.py index 728098d3a..2c459dead 100644 --- a/test/dialect/test_mysql.py +++ b/test/dialect/test_mysql.py @@ -82,6 +82,19 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): "PRIMARY KEY (data) USING btree)", dialect=mysql.dialect()) + def test_skip_deferrable_kw(self): + m = MetaData() + t1 = Table('t1', m, Column('id', Integer, primary_key=True)) + t2 = Table('t2', m, Column('id', Integer, + ForeignKey('t1.id', deferrable=True), + primary_key=True)) + + self.assert_compile( + schema.CreateTable(t2), + "CREATE TABLE t2 (id INTEGER NOT NULL, " + "PRIMARY KEY (id), FOREIGN KEY(id) REFERENCES t1 (id))" + ) + class DialectTest(fixtures.TestBase): __only_on__ = 'mysql' |