fix 'superset db history' (#3948)

* fix 'superset db history'

Related Error msg when running `superset db history`:
"NameError: Can't invoke function 'get_bind', as the proxy object has not
yet been established for the Alembic 'Operations' class.  Try placing
this code inside a callable."

* Lint
This commit is contained in:
Maxime Beauchemin 2017-11-29 20:52:56 -08:00 committed by GitHub
parent 34d6618b2e
commit 1ce14df43d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -34,11 +34,10 @@ datasources = sa.Table(
sa.Column('datasource_name', sa.String(255)),
)
bind = op.get_bind()
insp = sa.engine.reflection.Inspector.from_engine(bind)
def upgrade():
bind = op.get_bind()
insp = sa.engine.reflection.Inspector.from_engine(bind)
# Add the new less restrictive uniqueness constraint.
with op.batch_alter_table('datasources', naming_convention=conv) as batch_op:
@ -114,6 +113,8 @@ def upgrade():
def downgrade():
bind = op.get_bind()
insp = sa.engine.reflection.Inspector.from_engine(bind)
# Add the new more restrictive uniqueness constraint which is required by
# the foreign key constraints. Note this operation will fail if the