diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2020-12-14 16:35:56 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2020-12-14 16:35:56 +0000 |
| commit | aa47eca615eaf8277f6a6365a05539fda1b725e2 (patch) | |
| tree | 28567a48673024bd80473ff0a62f3f82a4ccc2f3 /lib/sqlalchemy/dialects/sqlite/base.py | |
| parent | 8d3254b6727b306e19dd0db299586b95caa46c9e (diff) | |
| parent | 0d50b0c7c5b0a9fda4c962f09900e45bebeb1a02 (diff) | |
| download | sqlalchemy-aa47eca615eaf8277f6a6365a05539fda1b725e2.tar.gz | |
Merge "Support IF EXISTS/IF NOT EXISTS for DDL constructs"
Diffstat (limited to 'lib/sqlalchemy/dialects/sqlite/base.py')
| -rw-r--r-- | lib/sqlalchemy/dialects/sqlite/base.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/sqlalchemy/dialects/sqlite/base.py b/lib/sqlalchemy/dialects/sqlite/base.py index c56c1f020..c53b3c228 100644 --- a/lib/sqlalchemy/dialects/sqlite/base.py +++ b/lib/sqlalchemy/dialects/sqlite/base.py @@ -1564,7 +1564,13 @@ class SQLiteDDLCompiler(compiler.DDLCompiler): text = "CREATE " if index.unique: text += "UNIQUE " - text += "INDEX %s ON %s (%s)" % ( + + text += "INDEX " + + if create.if_not_exists: + text += "IF NOT EXISTS " + + text += "%s ON %s (%s)" % ( self._prepared_index_name(index, include_schema=True), preparer.format_table(index.table, use_schema=False), ", ".join( |
