-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(migration): add log for values unseen in Slice.datasource_type
#23925
Merged
Merged
Changes from 2 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3bbb7c4
add log for values unseen
hughhhh 9f07e03
user logger
hughhhh 57a268c
Update 2023-03-27_12-30_7e67aecbf3f1_chart_ds_constraint.py
hughhhh bc251cf
Update 2023-03-27_12-30_7e67aecbf3f1_chart_ds_constraint.py
hughhhh 087c818
user log 1 more tiem
hughhhh 1c02d9c
lets try this one
hughhhh 3c7509f
Update superset/migrations/versions/2023-03-27_12-30_7e67aecbf3f1_cha…
hughhhh 46186be
Update superset/migrations/versions/2023-03-27_12-30_7e67aecbf3f1_cha…
hughhhh f72cde9
Update superset/migrations/versions/2023-03-27_12-30_7e67aecbf3f1_cha…
eschutho acdb06e
Update 2023-03-27_12-30_7e67aecbf3f1_chart_ds_constraint.py
hughhhh b8e7ef4
Update 2023-03-27_12-30_7e67aecbf3f1_chart_ds_constraint.py
hughhhh d0b8ac1
ok
hughhhh 77f44c3
Update superset/migrations/versions/2023-03-27_12-30_7e67aecbf3f1_cha…
eschutho 809292e
linting
hughhhh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
down_revision = "07f9a902af1b" | ||
|
||
import json | ||
import logging | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
@@ -36,6 +37,8 @@ | |
|
||
Base = declarative_base() | ||
|
||
logger = logging.getLogger() | ||
|
||
|
||
class Slice(Base): # type: ignore | ||
__tablename__ = "slices" | ||
|
@@ -63,9 +66,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: | ||
logger.info( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
f"unknown value detected for slc.datasource_type: {slc.datasource_type}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest also putting a log into line 60 above in case that's where the failure is. |
||
) | ||
|
||
batch_op.create_check_constraint( | ||
"ck_chart_datasource", "datasource_type in ('table')" | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logging.getLogger(__name__)