diff options
| author | Jesse Bakker <github@jessebakker.com> | 2022-09-06 16:00:10 -0400 |
|---|---|---|
| committer | mike bayer <mike_mp@zzzcomputing.com> | 2022-10-04 02:40:20 +0000 |
| commit | b6eed88ef4ebb3fd7035b4e366bf6653ebb26d15 (patch) | |
| tree | e98e19d6fa7b236cf2fc7eed3ffc96c805b80667 /test/sql/test_metadata.py | |
| parent | d5905ccd7df000143194975f8f3d72fcef0672e3 (diff) | |
| download | sqlalchemy-b6eed88ef4ebb3fd7035b4e366bf6653ebb26d15.tar.gz | |
Make if_exists and if_not_exists flags on ddl statements match compiler
Added ``if_exists`` and ``if_not_exists`` parameters for all "Create" /
"Drop" constructs including :class:`.CreateSequence`,
:class:`.DropSequence`, :class:`.CreateIndex`, :class:`.DropIndex`, etc.
allowing generic "IF EXISTS" / "IF NOT EXISTS" phrases to be rendered
within DDL. Pull request courtesy Jesse Bakker.
Fixes: #7354
Closes: #8492
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8492
Pull-request-sha: d107c6ce553bd430111607815f5b3938ffc4770c
Change-Id: I367e57b2d9216f5180bcc44e86ca6f3dc794e5ca
Diffstat (limited to 'test/sql/test_metadata.py')
| -rw-r--r-- | test/sql/test_metadata.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/sql/test_metadata.py b/test/sql/test_metadata.py index 38255f977..6d93cb234 100644 --- a/test/sql/test_metadata.py +++ b/test/sql/test_metadata.py @@ -2621,9 +2621,17 @@ class SchemaTest(fixtures.TestBase, AssertsCompiledSQL): schema.CreateSchema("sa_schema"), "CREATE SCHEMA sa_schema" ) self.assert_compile( + schema.CreateSchema("sa_schema", if_not_exists=True), + "CREATE SCHEMA IF NOT EXISTS sa_schema", + ) + self.assert_compile( schema.DropSchema("sa_schema"), "DROP SCHEMA sa_schema" ) self.assert_compile( + schema.DropSchema("sa_schema", if_exists=True), + "DROP SCHEMA IF EXISTS sa_schema", + ) + self.assert_compile( schema.DropSchema("sa_schema", cascade=True), "DROP SCHEMA sa_schema CASCADE", ) |
