You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "mcdogg17 (via GitHub)" <gi...@apache.org> on 2025/01/16 08:16:02 UTC

[PR] fix(import): ensure charts and datasets overwrite on report import [superset]

mcdogg17 opened a new pull request, #31888:
URL: https://github.com/apache/superset/pull/31888

   <!---
   Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   Previously, when importing a report in Superset, charts and datasets were not being overwritten, unlike when they were imported separately. 
   
   This update fixes the issue by ensuring the overwrite parameter is correctly passed to the import_database, import_dataset, and import_chart functions. Now, when importing a report, charts and datasets will be properly updated, eliminating the need for manual re-importing.
   
   Additionally, query_context handling in slice.py has been improved to correctly pass the datasource to QueryContextFactory.
   
   ### 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
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] 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(import): ensure charts and datasets overwrite on report import [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #31888:
URL: https://github.com/apache/superset/pull/31888#issuecomment-3885518352

   It's been a few months since we heard back here, so I'll close this out. Feel free to re-open if/when the time is right. Many thanks for this and any future contribution!


-- 
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(import): ensure charts and datasets overwrite on report import [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #31888:
URL: https://github.com/apache/superset/pull/31888#issuecomment-2599051047

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/31888?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   Attention: Patch coverage is `0%` with `4 lines` in your changes missing coverage. Please review.
   > Project coverage is 61.38%. Comparing base [(`2356702`)](https://app.codecov.io/gh/apache/superset/commit/235670244e71301fc8c58f48b95e4b0d6b5d8382?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`f901ba7`)](https://app.codecov.io/gh/apache/superset/commit/f901ba73d50408e713621e113ca8429637b4644d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   > Report is 1605 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/31888?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...perset/commands/dashboard/importers/v1/\_\_init\_\_.py](https://app.codecov.io/gh/apache/superset/pull/31888?src=pr&el=tree&filepath=superset%2Fcommands%2Fdashboard%2Fimporters%2Fv1%2F__init__.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvY29tbWFuZHMvZGFzaGJvYXJkL2ltcG9ydGVycy92MS9fX2luaXRfXy5weQ==) | 0.00% | [3 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/31888?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [superset/models/slice.py](https://app.codecov.io/gh/apache/superset/pull/31888?src=pr&el=tree&filepath=superset%2Fmodels%2Fslice.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvbW9kZWxzL3NsaWNlLnB5) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/31888?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   > :exclamation:  There is a different number of reports uploaded between BASE (2356702) and HEAD (f901ba7). Click for more details.
   > 
   > <details><summary>HEAD has 1 upload less than BASE</summary>
   >
   >| Flag | BASE (2356702) | HEAD (f901ba7) |
   >|------|------|------|
   >|python|4|3|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #31888      +/-   ##
   ==========================================
   - Coverage   67.46%   61.38%   -6.08%     
   ==========================================
     Files        1911     1940      +29     
     Lines       74966    77871    +2905     
     Branches     8353     8353              
   ==========================================
   - Hits        50573    47801    -2772     
   - Misses      22343    28020    +5677     
     Partials     2050     2050              
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/31888/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [mysql](https://app.codecov.io/gh/apache/superset/pull/31888/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [postgres](https://app.codecov.io/gh/apache/superset/pull/31888/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/31888/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `53.29% <0.00%> (?)` | |
   | [python](https://app.codecov.io/gh/apache/superset/pull/31888/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `65.29% <0.00%> (-12.89%)` | :arrow_down: |
   | [sqlite](https://app.codecov.io/gh/apache/superset/pull/31888/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unit](https://app.codecov.io/gh/apache/superset/pull/31888/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `61.03% <0.00%> (?)` | |
   
   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/31888?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).
   


-- 
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(import): ensure charts and datasets overwrite on report import [superset]

Posted by "mcdogg17 (via GitHub)" <gi...@apache.org>.
mcdogg17 commented on PR #31888:
URL: https://github.com/apache/superset/pull/31888#issuecomment-2594792390

   @supersetbot orglabel


-- 
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(import): ensure charts and datasets overwrite on report import [superset]

Posted by "korbit-ai[bot] (via GitHub)" <gi...@apache.org>.
korbit-ai[bot] commented on code in PR #31888:
URL: https://github.com/apache/superset/pull/31888#discussion_r1917932128


##########
superset/commands/dashboard/importers/v1/__init__.py:
##########
@@ -121,7 +121,7 @@ def _import(configs: dict[str, Any], overwrite: bool = False) -> None:
                 if "query_context" in config:
                     config["query_context"] = None

Review Comment:
   ### Query Context Information Loss <sub>![category Functionality](https://img.shields.io/badge/Functionality-0284c7)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The code unconditionally sets query_context to None, which contradicts the developer's intent to ensure datasource information is injected in get_query_context.
   
   ###### Why this matters
   Setting query_context to None will prevent any datasource information from being preserved during chart imports, potentially causing data inconsistencies during report execution.
   
   ###### Suggested change ∙ *Feature Preview*
   Instead of setting query_context to None, update it with the correct datasource information:
   ```python
                   if "query_context" in config:
                       config["query_context"]["datasource"] = dataset_uid
   ```
   
   
   </details>
   
   ###### Chat with Korbit by mentioning @korbit-ai, and give a 👍 or 👎 to help Korbit improve your reviews.
   
   
   <!--- korbi internal id:61bafd82-ae6d-4c1b-835f-f18b60e6d15e -->
   



-- 
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(import): ensure charts and datasets overwrite on report import [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed pull request #31888: fix(import): ensure charts and datasets overwrite on report import
URL: https://github.com/apache/superset/pull/31888


-- 
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(import): ensure charts and datasets overwrite on report import [superset]

Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on PR #31888:
URL: https://github.com/apache/superset/pull/31888#issuecomment-2605472086

   Might be a feature, but would be good to have a checkbox on imports that ask if the user wants to overwrite. Would also fix workflows where we want to know if things should be overwritten or not.


-- 
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(import): ensure charts and datasets overwrite on report import [superset]

Posted by "mcdogg17 (via GitHub)" <gi...@apache.org>.
mcdogg17 commented on PR #31888:
URL: https://github.com/apache/superset/pull/31888#issuecomment-2609464058

   @supersetbot orglabel


-- 
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(import): ensure charts and datasets overwrite on report import [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #31888:
URL: https://github.com/apache/superset/pull/31888#issuecomment-2599319679

   I defer to @betodealmeida and @dpgaspar here, but I can imagine somoene importing a report, and _accidentally_ overwriting a bunch of charts and datasets and impacting the dashboards of untold numbers of users. Seems dangerous to me. It seems like it'd be ideal if instead of _overwriting_ an asset, we could create a *version* of the asset. That's been discussed a bit, but is dependent on a yet-to-come SIP.


-- 
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(import): ensure charts and datasets overwrite on report import [superset]

Posted by "mcdogg17 (via GitHub)" <gi...@apache.org>.
mcdogg17 commented on PR #31888:
URL: https://github.com/apache/superset/pull/31888#issuecomment-2611682610

   
   Hi! I'll take into account all the comments above and get back to you in a while.


-- 
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(import): ensure charts and datasets overwrite on report import [superset]

Posted by "Vitor-Avila (via GitHub)" <gi...@apache.org>.
Vitor-Avila commented on PR #31888:
URL: https://github.com/apache/superset/pull/31888#issuecomment-2607386808

   I agree this should be optional, like a checkbox in the import dialog to "Also overwrite dependencies" or etc, defaulted to un-checked. 
   
   Overwriting all dependencies is currently already possible via the `/api/v1/assets/import/` endpoint, but having this as a new feature via the UI is definitely helpful! 🙌 


-- 
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(import): ensure charts and datasets overwrite on report import [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #31888:
URL: https://github.com/apache/superset/pull/31888#issuecomment-3180899812

   Looks like we don't have that confirmation yet that @sadpandajoe suggested. I'll convert this to draft for now while we await that.


-- 
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