--- /dev/null
+.. change::
+ :tags: bug, sqlite
+ :tickets: 12368
+
+ Fixed a bug that caused incorrect DDL when setting
+ :paramref:`.Table.sqlite_with_rowid` to ``False`` in combination with
+ :paramref:`.Table.sqlite_strict` to ``True``.
return text
def post_create_table(self, table):
- text = ""
- if table.dialect_options["sqlite"]["with_rowid"] is False:
- text += "\n WITHOUT ROWID"
- if table.dialect_options["sqlite"]["strict"] is True:
- text += "\n STRICT"
- return text
+ table_options = []
+
+ if not table.dialect_options["sqlite"]["with_rowid"]:
+ table_options.append("WITHOUT ROWID")
+
+ if table.dialect_options["sqlite"]["strict"]:
+ table_options.append("STRICT")
+
+ if table_options:
+ return "\n " + ",\n ".join(table_options)
+ else:
+ return ""
class SQLiteTypeCompiler(compiler.GenericTypeCompiler):
"CREATE TABLE atable (id INTEGER) STRICT",
)
+ def test_create_table_without_rowid_strict(self):
+ m = MetaData()
+ table = Table("atable", m, Column("id", Integer), sqlite_with_rowid=False, sqlite_strict=True)
+ self.assert_compile(
+ schema.CreateTable(table),
+ "CREATE TABLE atable (id INTEGER) WITHOUT ROWID, STRICT",
+ )
+
class OnConflictDDLTest(fixtures.TestBase, AssertsCompiledSQL):
__dialect__ = sqlite.dialect()