From 1ce14df43de76f69776fbd2d7e94560ea5c10cad Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Wed, 29 Nov 2017 20:52:56 -0800 Subject: [PATCH] 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 --- superset/migrations/versions/4736ec66ce19_.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/superset/migrations/versions/4736ec66ce19_.py b/superset/migrations/versions/4736ec66ce19_.py index 2d560d57d..de86a3922 100644 --- a/superset/migrations/versions/4736ec66ce19_.py +++ b/superset/migrations/versions/4736ec66ce19_.py @@ -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