diff options
| author | Miroslav Shubernetskiy <miroslav@miki725.com> | 2018-02-05 09:07:30 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-02-05 11:14:19 -0500 |
| commit | d53533fbd12b2cbb91cb35613be25735a50a6d66 (patch) | |
| tree | caf12cc95eec2796579d16669902428f317edda4 /lib/sqlalchemy/testing | |
| parent | 00570a6ac9453a48b06ca094de6e0502c3b73fa5 (diff) | |
| download | sqlalchemy-d53533fbd12b2cbb91cb35613be25735a50a6d66.tar.gz | |
Support foreign key option reflection for Oracle
The ON DELETE options for foreign keys are now part of
Oracle reflection. Oracle does not support ON UPDATE
cascades. Pull request courtesy Miroslav Shubernetskiy.
Change-Id: I135cd6cd3436354a86b2c1e1437c3785c38eed26
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/418
Diffstat (limited to 'lib/sqlalchemy/testing')
| -rw-r--r-- | lib/sqlalchemy/testing/requirements.py | 6 | ||||
| -rw-r--r-- | lib/sqlalchemy/testing/suite/test_reflection.py | 15 |
2 files changed, 16 insertions, 5 deletions
diff --git a/lib/sqlalchemy/testing/requirements.py b/lib/sqlalchemy/testing/requirements.py index 1990eb9d5..b509c94d6 100644 --- a/lib/sqlalchemy/testing/requirements.py +++ b/lib/sqlalchemy/testing/requirements.py @@ -409,7 +409,11 @@ class SuiteRequirements(Requirements): return exclusions.open() @property - def foreign_key_constraint_option_reflection(self): + def foreign_key_constraint_option_reflection_ondelete(self): + return exclusions.closed() + + @property + def foreign_key_constraint_option_reflection_onupdate(self): return exclusions.closed() @property diff --git a/lib/sqlalchemy/testing/suite/test_reflection.py b/lib/sqlalchemy/testing/suite/test_reflection.py index 0c391fad0..1275cac03 100644 --- a/lib/sqlalchemy/testing/suite/test_reflection.py +++ b/lib/sqlalchemy/testing/suite/test_reflection.py @@ -540,9 +540,16 @@ class ComponentReflectionTest(fixtures.TablesTest): def test_get_foreign_keys_with_schema(self): self._test_get_foreign_keys(schema=testing.config.test_schema) - @testing.requires.foreign_key_constraint_option_reflection + @testing.requires.foreign_key_constraint_option_reflection_ondelete + def test_get_foreign_key_options_ondelete(self): + self._test_get_foreign_key_options(ondelete="CASCADE") + + @testing.requires.foreign_key_constraint_option_reflection_onupdate + def test_get_foreign_key_options_onupdate(self): + self._test_get_foreign_key_options(onupdate="SET NULL") + @testing.provide_metadata - def test_get_foreign_key_options(self): + def _test_get_foreign_key_options(self, **options): meta = self.metadata Table( @@ -564,7 +571,7 @@ class ComponentReflectionTest(fixtures.TablesTest): sa.ForeignKeyConstraint( ['tid'], ['table.id'], name='myfk', - onupdate="SET NULL", ondelete="CASCADE"), + **options), test_needs_fk=True) meta.create_all() @@ -589,7 +596,7 @@ class ComponentReflectionTest(fixtures.TablesTest): (k, opts[k]) for k in opts if opts[k] ), - {'onupdate': 'SET NULL', 'ondelete': 'CASCADE'} + options ) def _assert_insp_indexes(self, indexes, expected_indexes): |
