diff options
Diffstat (limited to 'lib/sqlalchemy/dialects/sqlite/base.py')
| -rw-r--r-- | lib/sqlalchemy/dialects/sqlite/base.py | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/sqlalchemy/dialects/sqlite/base.py b/lib/sqlalchemy/dialects/sqlite/base.py index 5efd0d9c9..aead99147 100644 --- a/lib/sqlalchemy/dialects/sqlite/base.py +++ b/lib/sqlalchemy/dialects/sqlite/base.py @@ -583,6 +583,21 @@ or on a per-:class:`_engine.Engine` basis:: When using the per-:class:`_engine.Engine` execution option, note that **Core and ORM queries that use UNION may not function properly**. +SQLite-specific table options +----------------------------- + +One option for CREATE TABLE is supported directly by the SQLite +dialect in conjunction with the :class:`_schema.Table` construct: + +* ``WITHOUT ROWID``:: + + Table("some_table", metadata, ..., sqlite_with_rowid=False) + +.. seealso:: + + `SQLite CREATE TABLE options + <https://www.sqlite.org/lang_createtable.html>`_ + """ # noqa import datetime @@ -1259,6 +1274,11 @@ class SQLiteDDLCompiler(compiler.DDLCompiler): return text + def post_create_table(self, table): + if table.dialect_options["sqlite"]["with_rowid"] is False: + return "\n WITHOUT ROWID" + return "" + class SQLiteTypeCompiler(compiler.GenericTypeCompiler): def visit_large_binary(self, type_, **kw): @@ -1466,7 +1486,13 @@ class SQLiteDialect(default.DefaultDialect): isolation_level = None construct_arguments = [ - (sa_schema.Table, {"autoincrement": False}), + ( + sa_schema.Table, + { + "autoincrement": False, + "with_rowid": True, + }, + ), (sa_schema.Index, {"where": None}), ( sa_schema.Column, |
