]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Support IF EXISTS/IF NOT EXISTS for DDL constructs
authorRamonWill <ramonwilliams@hotmail.co.uk>
Wed, 21 Oct 2020 12:24:27 +0000 (08:24 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 14 Dec 2020 15:19:21 +0000 (10:19 -0500)
commit0d50b0c7c5b0a9fda4c962f09900e45bebeb1a02
tree72ecf3b97df6e84ebbffa486e07ebde3aaa35e0a
parent89ddd0b8976ed695d239898a2a8e4ebf531537f2
Support IF EXISTS/IF NOT EXISTS for DDL constructs

Added parameters :paramref:`_ddl.CreateTable.if_not_exists`,
:paramref:`_ddl.CreateIndex.if_not_exists`,
:paramref:`_ddl.DropTable.if_exists` and
:paramref:`_ddl.DropIndex.if_exists` to the :class:`_ddl.CreateTable`,
:class:`_ddl.DropTable`, :class:`_ddl.CreateIndex` and
:class:`_ddl.DropIndex` constructs which result in "IF NOT EXISTS" / "IF
EXISTS" DDL being added to the CREATE/DROP. These phrases are not accepted
by all databases and the operation will fail on a database that does not
support it as there is no similarly compatible fallback within the scope of
a single DDL statement.  Pull request courtesy Ramon Williams.

Fixes: #2843
Closes: #5663
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5663
Pull-request-sha: 748b8472345d96efb446e2a444fbe020b313669f

Change-Id: I6a2b1f697993ed49c31584f0a31887fb0a868ed3
doc/build/changelog/unreleased_14/2843.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mysql/base.py
lib/sqlalchemy/dialects/postgresql/base.py
lib/sqlalchemy/dialects/sqlite/base.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/ddl.py
lib/sqlalchemy/testing/requirements.py
lib/sqlalchemy/testing/suite/test_ddl.py
test/requirements.py
test/sql/test_compiler.py