]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Add DDL association to Table, CreateView support
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 25 Oct 2025 17:19:48 +0000 (13:19 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 8 Nov 2025 18:42:15 +0000 (13:42 -0500)
commit98361f19a8144cbc8d528c62a873786be65fc026
treed3c9660cb81398c8245ee535d3165f0c51c09042
parent2bd8e962c7b8e0abf7396ac3a8ad82a9334a62e1
Add DDL association to Table, CreateView support

Added support for the SQL ``CREATE VIEW`` statement via the new
:class:`.CreateView` DDL class. The new class allows creating database
views from SELECT statements, with support for options such as
``TEMPORARY``, ``IF NOT EXISTS``, and ``MATERIALIZED`` where supported by
the target database. Views defined with :class:`.CreateView` integrate with
:class:`.MetaData` for automated DDL generation and provide a
:class:`.Table` object for querying.

this alters the CreateTableAs commit:

* adds the ability for Table to be associated with Create and Drop
  DDL constructs
* Adds CreateView variant of CreateTableAs
* Both associate themselves with Table so they take place in
  create_all/create/drop_all/drop

Fixes: #181
Change-Id: If3e568d3d6a6ce19e3d15198c3fbbe06bd847c83
31 files changed:
doc/build/changelog/migration_21.rst
doc/build/changelog/unreleased_21/181.rst [new file with mode: 0644]
doc/build/changelog/unreleased_21/4950.rst
doc/build/core/ddl.rst
doc/build/core/metadata.rst
doc/build/tutorial/data_select.rst
lib/sqlalchemy/__init__.py
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/dialects/sqlite/base.py
lib/sqlalchemy/schema.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/ddl.py
lib/sqlalchemy/sql/schema.py
lib/sqlalchemy/sql/selectable.py
lib/sqlalchemy/testing/config.py
lib/sqlalchemy/testing/provision.py
lib/sqlalchemy/testing/requirements.py
lib/sqlalchemy/testing/suite/__init__.py
lib/sqlalchemy/testing/suite/test_create_table_as.py [deleted file]
lib/sqlalchemy/testing/suite/test_ddl.py
lib/sqlalchemy/testing/suite/test_reflection.py
lib/sqlalchemy/testing/suite/test_table_via_select.py [new file with mode: 0644]
test/base/test_tutorials.py
test/base/test_utils.py
test/dialect/mssql/test_compiler.py
test/dialect/sqlite/test_compiler.py
test/requirements.py
test/sql/test_create_table_as.py [deleted file]
test/sql/test_ddlemit.py
test/sql/test_metadata.py
test/sql/test_table_via_select.py [new file with mode: 0644]