Skip to main content

module provide *create table as* statement

Project description

"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!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlalchemy_create_table_as-0.3.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqlalchemy_create_table_as-0.3.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file sqlalchemy_create_table_as-0.3.0.tar.gz.

File metadata

  • Download URL: sqlalchemy_create_table_as-0.3.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.10.6 Linux/5.15.0-1031-azure

File hashes

Hashes for sqlalchemy_create_table_as-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1d44db199e941151f4ab1bc01301f621bdf1be2f617cb07930e73ff7f71ddc38
MD5 7285a5546a6d43235dd92c5bfb739e93
BLAKE2b-256 1e5411b350d9137bf47e1daba18880f902adb5cdf4fe35c1e1170869c698f667

See more details on using hashes here.

File details

Details for the file sqlalchemy_create_table_as-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sqlalchemy_create_table_as-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c2754140046531eadf2c1d43132753f7c89294ee650348844ea092927f9f174
MD5 d3e1336319bfc7c2ed58c7dc237fe9a7
BLAKE2b-256 0332139c6011217f0164c0f9284a1405a79c43dcc951b92915bf5ca2bce7c1f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page