Table("some_table", metadata, ..., sqlite_with_rowid=False)
+*
+ ``STRICT``::
+
+ Table("some_table", metadata, ..., sqlite_strict=True)
+
+ .. versionadded:: 2.0.37
+
.. seealso::
`SQLite CREATE TABLE options
<https://www.sqlite.org/lang_createtable.html>`_
-
.. _sqlite_include_internal:
Reflecting internal schema tables
return text
def post_create_table(self, table):
+ text = ""
if table.dialect_options["sqlite"]["with_rowid"] is False:
- return "\n WITHOUT ROWID"
- return ""
+ text += "\n WITHOUT ROWID"
+ if table.dialect_options["sqlite"]["strict"] is True:
+ text += "\n STRICT"
+ return text
class SQLiteTypeCompiler(compiler.GenericTypeCompiler):
{
"autoincrement": False,
"with_rowid": True,
+ "strict": False,
},
),
(sa_schema.Index, {"where": None}),
"CREATE TABLE atable (id INTEGER) WITHOUT ROWID",
)
+ def test_create_table_strict(self):
+ m = MetaData()
+ table = Table("atable", m, Column("id", Integer), sqlite_strict=True)
+ self.assert_compile(
+ schema.CreateTable(table),
+ "CREATE TABLE atable (id INTEGER) STRICT",
+ )
+
class OnConflictDDLTest(fixtures.TestBase, AssertsCompiledSQL):
__dialect__ = sqlite.dialect()