apache / superset

Apache Superset is a Data Visualization and Data Exploration Platform
https://superset.apache.org/
Apache License 2.0
61.99k stars 13.59k forks source link

fix: KeyError 'sql' when opening a Trino virtual dataset #30339

Closed michael-s-molina closed 1 week ago

michael-s-molina commented 1 week ago

SUMMARY

https://github.com/apache/superset/pull/27470 modified the logic to validate a SQL Lab query by checking the access permission before any Jinja rendering occurs as some Jinja macros execute statements upon rendering. Those changes left an unused shallow copy statement that was interfering with SQL Alchemy internal state provoking key errors. This PR removes the unused statements.

Fixes https://github.com/apache/superset/issues/30338

TESTING INSTRUCTIONS

Follow the instructions described in the original issue.

ADDITIONAL INFORMATION

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 83.89%. Comparing base (76d897e) to head (2bded1e). Report is 756 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #30339 +/- ## =========================================== + Coverage 60.48% 83.89% +23.41% =========================================== Files 1931 533 -1398 Lines 76236 38489 -37747 Branches 8568 0 -8568 =========================================== - Hits 46114 32292 -13822 + Misses 28017 6197 -21820 + Partials 2105 0 -2105 ``` | [Flag](https://app.codecov.io/gh/apache/superset/pull/30339/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/30339/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `49.00% <ø> (-0.16%)` | :arrow_down: | | [javascript](https://app.codecov.io/gh/apache/superset/pull/30339/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | | | [mysql](https://app.codecov.io/gh/apache/superset/pull/30339/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `76.86% <ø> (?)` | | | [postgres](https://app.codecov.io/gh/apache/superset/pull/30339/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `76.94% <ø> (?)` | | | [presto](https://app.codecov.io/gh/apache/superset/pull/30339/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `53.51% <ø> (-0.30%)` | :arrow_down: | | [python](https://app.codecov.io/gh/apache/superset/pull/30339/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `83.89% <ø> (+20.41%)` | :arrow_up: | | [sqlite](https://app.codecov.io/gh/apache/superset/pull/30339/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `76.38% <ø> (?)` | | | [unit](https://app.codecov.io/gh/apache/superset/pull/30339/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `60.61% <ø> (+2.98%)` | :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.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.