This is an automated email from the ASF dual-hosted git repository. hugh pushed a commit to branch chart-ds-constraint-update in repository https://gitbox.apache.org/repos/asf/superset.git
commit 3bbb7c4a0dc026801e94eb112c13c1dcec475a83 Author: hughhhh <[email protected]> AuthorDate: Wed May 3 17:08:27 2023 -0400 add log for values unseen --- .../2023-03-27_12-30_7e67aecbf3f1_chart_ds_constraint.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 f7d6ca5656..793b51bd28 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 @@ -63,9 +63,15 @@ def upgrade(): session = db.Session(bind=bind) with op.batch_alter_table("slices") as batch_op: - for slc in session.query(Slice).filter(Slice.datasource_type == "query").all(): - upgrade_slc(slc) - session.add(slc) + for slc in session.query(Slice).filter(Slice.datasource_type != "table").all(): + if slc.datasource_type == "query": + upgrade_slc(slc) + session.add(slc) + + else: + print( + f"unknown value detected for slc.datasource_type: {slc.datasource_type}" + ) batch_op.create_check_constraint( "ck_chart_datasource", "datasource_type in ('table')"
