You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "Antonio-RiveroMartnez (via GitHub)" <gi...@apache.org> on 2025/03/07 12:43:27 UTC
[PR] fix(migrations): Ignore slices with no comparator in the comparison migration [superset]
Antonio-RiveroMartnez opened a new pull request, #32538:
URL: https://github.com/apache/superset/pull/32538
### SUMMARY
The time comparison migration doesn't handle slices that have comparator set as None, causing the migration to fail. This PR fixes that behavior and make the migration a noop for those slices.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [X] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [X] Migration is atomic, supports rollback & is backwards-compatible
- [X] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
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
Re: [PR] fix(migrations): Handle comparator None in old time comparison migration [superset]
Posted by "betodealmeida (via GitHub)" <gi...@apache.org>.
betodealmeida commented on code in PR #32538:
URL: https://github.com/apache/superset/pull/32538#discussion_r1985256261
##########
superset/migrations/versions/2024-05-10_18-02_f84fde59123a_update_charts_with_old_time_comparison.py:
##########
@@ -85,7 +85,7 @@ def upgrade_comparison_params(slice_params: dict[str, Any]) -> dict[str, Any]:
# Adjust adhoc_custom
if "adhoc_custom" in params and params["adhoc_custom"]:
adhoc = params["adhoc_custom"][0] # As there's always only one element
- if adhoc["comparator"] != "No filter":
Review Comment:
I'm confused, why would this fail if the value is `None`?
```python
>>> None != "No filter"
True
```
--
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
Re: [PR] fix(migrations): Handle comparator None in old time comparison migration [superset]
Posted by "Antonio-RiveroMartnez (via GitHub)" <gi...@apache.org>.
Antonio-RiveroMartnez merged PR #32538:
URL: https://github.com/apache/superset/pull/32538
--
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
Re: [PR] fix(migrations): Handle comparator None in old time comparison migration [superset]
Posted by "Antonio-RiveroMartnez (via GitHub)" <gi...@apache.org>.
Antonio-RiveroMartnez commented on code in PR #32538:
URL: https://github.com/apache/superset/pull/32538#discussion_r1985260291
##########
superset/migrations/versions/2024-05-10_18-02_f84fde59123a_update_charts_with_old_time_comparison.py:
##########
@@ -85,7 +85,7 @@ def upgrade_comparison_params(slice_params: dict[str, Any]) -> dict[str, Any]:
# Adjust adhoc_custom
if "adhoc_custom" in params and params["adhoc_custom"]:
adhoc = params["adhoc_custom"][0] # As there's always only one element
- if adhoc["comparator"] != "No filter":
Review Comment:
it would enter this conditional and `start_date_offset.strftime("%Y-%m-%d")` would fail since get_since_until(adhoc["comparator"]) would return None as the start_date
--
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
Re: [PR] fix(migrations): Handle comparator None in old time comparison migration [superset]
Posted by "Antonio-RiveroMartnez (via GitHub)" <gi...@apache.org>.
Antonio-RiveroMartnez commented on code in PR #32538:
URL: https://github.com/apache/superset/pull/32538#discussion_r1985260291
##########
superset/migrations/versions/2024-05-10_18-02_f84fde59123a_update_charts_with_old_time_comparison.py:
##########
@@ -85,7 +85,7 @@ def upgrade_comparison_params(slice_params: dict[str, Any]) -> dict[str, Any]:
# Adjust adhoc_custom
if "adhoc_custom" in params and params["adhoc_custom"]:
adhoc = params["adhoc_custom"][0] # As there's always only one element
- if adhoc["comparator"] != "No filter":
Review Comment:
it would enter this conditional and `start_date_offset.strftime("%Y-%m-%d")` would fail since `get_since_until(adhoc["comparator"])` would return `None` as the `start_date`. So the PR is preventing the `AttributeError: 'NoneType'` in case it's `None`
--
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
Re: [PR] fix(migrations): Ignore slices with no comparator in the comparison migration [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #32538:
URL: https://github.com/apache/superset/pull/32538#issuecomment-2706379579
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/32538?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 65.72%. Comparing base [(`76d897e`)](https://app.codecov.io/gh/apache/superset/commit/76d897eaa2f9e137102bc194c2e3109c29d0348f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`1499d2b`)](https://app.codecov.io/gh/apache/superset/commit/1499d2bbf1023de8805a07691f23f6f5335eeb71?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
> Report is 1550 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #32538 +/- ##
==========================================
+ Coverage 60.48% 65.72% +5.23%
==========================================
Files 1931 547 -1384
Lines 76236 39309 -36927
Branches 8568 0 -8568
==========================================
- Hits 46114 25836 -20278
+ Misses 28017 13473 -14544
+ Partials 2105 0 -2105
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/32538/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [hive](https://app.codecov.io/gh/apache/superset/pull/32538/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `48.49% <ø> (-0.67%)` | :arrow_down: |
| [javascript](https://app.codecov.io/gh/apache/superset/pull/32538/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [presto](https://app.codecov.io/gh/apache/superset/pull/32538/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `52.99% <ø> (-0.81%)` | :arrow_down: |
| [python](https://app.codecov.io/gh/apache/superset/pull/32538/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `65.72% <ø> (+2.23%)` | :arrow_up: |
| [unit](https://app.codecov.io/gh/apache/superset/pull/32538/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `61.28% <ø> (+3.66%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/32538?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary>🚀 New features to boost your workflow: </summary>
- ❄ [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- 📦 [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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
Re: [PR] fix(migrations): Handle comparator None in old time comparison migration [superset]
Posted by "Antonio-RiveroMartnez (via GitHub)" <gi...@apache.org>.
Antonio-RiveroMartnez commented on code in PR #32538:
URL: https://github.com/apache/superset/pull/32538#discussion_r1985260291
##########
superset/migrations/versions/2024-05-10_18-02_f84fde59123a_update_charts_with_old_time_comparison.py:
##########
@@ -85,7 +85,7 @@ def upgrade_comparison_params(slice_params: dict[str, Any]) -> dict[str, Any]:
# Adjust adhoc_custom
if "adhoc_custom" in params and params["adhoc_custom"]:
adhoc = params["adhoc_custom"][0] # As there's always only one element
- if adhoc["comparator"] != "No filter":
Review Comment:
it would enter this conditional and `start_date_offset.strftime("%Y-%m-%d")` would fail since get_since_until(adhoc["comparator"]) would return `None` as the start_date. So the PR is preventing the `AttributeError: 'NoneType'` in case it's `None`
--
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
Re: [PR] fix(migrations): Handle comparator None in old time comparison migration [superset]
Posted by "Antonio-RiveroMartnez (via GitHub)" <gi...@apache.org>.
Antonio-RiveroMartnez commented on code in PR #32538:
URL: https://github.com/apache/superset/pull/32538#discussion_r1985260291
##########
superset/migrations/versions/2024-05-10_18-02_f84fde59123a_update_charts_with_old_time_comparison.py:
##########
@@ -85,7 +85,7 @@ def upgrade_comparison_params(slice_params: dict[str, Any]) -> dict[str, Any]:
# Adjust adhoc_custom
if "adhoc_custom" in params and params["adhoc_custom"]:
adhoc = params["adhoc_custom"][0] # As there's always only one element
- if adhoc["comparator"] != "No filter":
Review Comment:
it would enter this conditional and `start_date_offset.strftime("%Y-%m-%d")` would fail since `get_since_until(adhoc["comparator"])` would return `None` as the `start_date`. So the PR is preventing the `AttributeError: 'NoneType'`
--
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
Re: [PR] fix(migrations): Handle comparator None in old time comparison migration [superset]
Posted by "betodealmeida (via GitHub)" <gi...@apache.org>.
betodealmeida commented on code in PR #32538:
URL: https://github.com/apache/superset/pull/32538#discussion_r1985265504
##########
superset/migrations/versions/2024-05-10_18-02_f84fde59123a_update_charts_with_old_time_comparison.py:
##########
@@ -85,7 +85,7 @@ def upgrade_comparison_params(slice_params: dict[str, Any]) -> dict[str, Any]:
# Adjust adhoc_custom
if "adhoc_custom" in params and params["adhoc_custom"]:
adhoc = params["adhoc_custom"][0] # As there's always only one element
- if adhoc["comparator"] != "No filter":
Review Comment:
Ah, I see, the problem is down the line. Makes sense, thanks!
--
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