As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Alembic support

Alembic is a lightweight database migration tool for usage with the SQLAlchemy Database Toolkit for Python. It can use this BigQuery SQLAlchemy support to manage BigQuery shemas.

Some features, like management of constrains and indexes, aren’t supported because BigQuery doesn’t support them.

Supported operations:

add_column(table_name, column, schema=None)

alter_column(table_name, column_name, nullable=None, schema=None, type_=None)

bulk_insert(table, rows, multiinsert=True)

create_table(table_name, *columns, **kw)

create_table_comment(table_name, comment, schema=None)

drop_column(table_name, column_name, schema=None)

drop_table(table_name, schema=None)

drop_table_comment(table_name, schema=None)

execute(sqltext, execution_options=None)

rename_table(old_table_name, new_table_name, schema=None)

Note that some of the operations above have limited capability, again due to BigQuery limitations.

The execute operation allows access to BigQuery-specific data-definition-language.