You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "michael-s-molina (via GitHub)" <gi...@apache.org> on 2023/09/18 14:19:20 UTC

[GitHub] [superset] michael-s-molina commented on a diff in pull request #25304: feat: Adds CLI commands to execute viz migrations

michael-s-molina commented on code in PR #25304:
URL: https://github.com/apache/superset/pull/25304#discussion_r1328804364


##########
superset/migrations/shared/migrate_viz/base.py:
##########
@@ -156,9 +156,7 @@ def downgrade_slice(cls, slc: Slice) -> Slice:
         return slc
 
     @classmethod
-    def upgrade(cls) -> None:
-        bind = op.get_bind()
-        session = db.Session(bind=bind)
+    def upgrade(cls, session: Session) -> None:
         slices = session.query(Slice).filter(Slice.viz_type == cls.source_viz_type)

Review Comment:
   I tried using `db.session` but it completely broke CI. I decided to remove session creation from the base class and leave that responsibility with the migration callers. This preserves the current behavior of Alembic migrations and at the same time allows the migration to be called from commands.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org