Warning
This document is for an old release of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.
Source code for galaxy.model.migrations.util
import logging
from alembic import op
from sqlalchemy import inspect
log = logging.getLogger(__name__)
[docs]def drop_column(table_name, column_name):
with op.batch_alter_table(table_name) as batch_op:
batch_op.drop_column(column_name)
[docs]def column_exists(table_name, column_name):
bind = op.get_context().bind
insp = inspect(bind)
columns = insp.get_columns(table_name)
return any(c["name"] == column_name for c in columns)