Skip to main content

"Create Table As" form for SQLAlchemy

Add create table as construct to SQLalchemy

Usage

Examples:

>>> from sqlalchemy import *
>>> from sqlalchemy_create_table_as import *
>>> str(
...     CreateTableAs(
...         table('new_table'), 
...         select(column('f1'), column('f2')).select_from(table('old_table'))
...         )
... )
'CREATE TABLE new_table AS SELECT f1, f2 \nFROM old_table'
 
>>> t = Table('old_table', MetaData(), Column('f1'), Column('f2'))

>>> str(CreateTableAs(table('new_table'), select(t)))
>>> 'CREATE TABLE new_table AS SELECT old_table.f1, old_table.f2 \nFROM old_table'

Installation

sqlalchemy-create-table-as is available on PyPI and can be installed via pip

pip install sqlalchemy-create-table-as

Acknowledgements

Package inspired by sqlalchemy-views

And thank you to the various contributors!

Metadata

Release files for sqlalchemy-create-table-as 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sqlalchemy-create-table-as 0.3.0
File Size Uploaded
sqlalchemy_create_table_as-0.3.0.tar.gz 3.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sqlalchemy-create-table-as 0.3.0
File Interpreter ABI Platform
sqlalchemy_create_table_as-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.6 kB

Release files / sqlalchemy_create_table_as-0.3.0.tar.gz

Download URL sqlalchemy_create_table_as-0.3.0.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1d44db199e941151f4ab1bc01301f621bdf1be2f617cb07930e73ff7f71ddc38
BLAKE2b-256 checksum
How to use checksums
1e5411b350d9137bf47e1daba18880f902adb5cdf4fe35c1e1170869c698f667
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.1 CPython/3.10.6 Linux/5.15.0-1031-azure

Release files / sqlalchemy_create_table_as-0.3.0-py3-none-any.whl

Download URL sqlalchemy_create_table_as-0.3.0-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c2754140046531eadf2c1d43132753f7c89294ee650348844ea092927f9f174
BLAKE2b-256 checksum
How to use checksums
0332139c6011217f0164c0f9284a1405a79c43dcc951b92915bf5ca2bce7c1f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.1 CPython/3.10.6 Linux/5.15.0-1031-azure

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page