This is an automated email from the ASF dual-hosted git repository.

lilykuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new f3f5d926c1 fix: update migration chart_ds_constraint to have seperate 
batch op (#23942)
f3f5d926c1 is described below

commit f3f5d926c10769e3c0b53947a690280ccccf75ad
Author: Hugh A. Miles II <[email protected]>
AuthorDate: Thu May 4 16:53:43 2023 -0400

    fix: update migration chart_ds_constraint to have seperate batch op (#23942)
---
 .../versions/2023-03-27_12-30_7e67aecbf3f1_chart_ds_constraint.py    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/superset/migrations/versions/2023-03-27_12-30_7e67aecbf3f1_chart_ds_constraint.py
 
b/superset/migrations/versions/2023-03-27_12-30_7e67aecbf3f1_chart_ds_constraint.py
index 8d3115acbd..4c6941fe84 100644
--- 
a/superset/migrations/versions/2023-03-27_12-30_7e67aecbf3f1_chart_ds_constraint.py
+++ 
b/superset/migrations/versions/2023-03-27_12-30_7e67aecbf3f1_chart_ds_constraint.py
@@ -84,7 +84,6 @@ def upgrade_slc(slc: Slice) -> None:
 def upgrade():
     bind = op.get_bind()
     session = db.Session(bind=bind)
-
     with op.batch_alter_table("slices") as batch_op:
         for slc in session.query(Slice).filter(Slice.datasource_type != 
"table").all():
             if slc.datasource_type == "query":
@@ -97,6 +96,10 @@ def upgrade():
                     slc.datasource_type,
                 )
 
+    # need commit the updated values for Slice.datasource_type before creating 
constraint
+    session.commit()
+
+    with op.batch_alter_table("slices") as batch_op:
         batch_op.create_check_constraint(
             "ck_chart_datasource", "datasource_type in ('table')"
         )

Reply via email to