You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/10/06 13:41:09 UTC

[GitHub] [superset] ofekisr opened a new pull request #16991: fix(QueryContext): validation does not validate query_context metrics

ofekisr opened a new pull request #16991:
URL: https://github.com/apache/superset/pull/16991


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


[GitHub] [superset] ofekisr commented on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
ofekisr commented on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-975868794


   @craig-rueda @hughhhh @jayakrishnankk 
   After all the recent refactor in ChartData, I recommitted the PR with all the adjustments to refactored code 


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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (83dca79) into [master](https://codecov.io/gh/apache/superset/commit/16e012fe5d791ed6aa5ab755a6386b1581fc5ebd?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (16e012f) will **decrease** coverage by `0.16%`.
   > The diff coverage is `85.91%`.
   
   > :exclamation: Current head 83dca79 differs from pull request most recent head c451abf. Consider uploading reports for the commit c451abf to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   - Coverage   76.95%   76.78%   -0.17%     
   ==========================================
     Files        1047     1048       +1     
     Lines       56498    56620     +122     
     Branches     7798     7798              
   ==========================================
   + Hits        43476    43477       +1     
   - Misses      12766    12887     +121     
     Partials      256      256              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `81.98% <85.91%> (?)` | |
   | postgres | `81.99% <85.91%> (-0.01%)` | :arrow_down: |
   | presto | `?` | |
   | python | `82.08% <85.91%> (-0.34%)` | :arrow_down: |
   | sqlite | `81.67% <85.91%> (?)` | |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/common/query\_object.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X29iamVjdC5weQ==) | `92.13% <60.00%> (-0.93%)` | :arrow_down: |
   | [superset/datasets/dao.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvZGFvLnB5) | `93.24% <66.66%> (-0.55%)` | :arrow_down: |
   | [superset/common/query\_context.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2NvbnRleHQucHk=) | `84.61% <72.72%> (-7.84%)` | :arrow_down: |
   | [superset/tasks/async\_queries.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdGFza3MvYXN5bmNfcXVlcmllcy5weQ==) | `90.36% <85.71%> (-0.67%)` | :arrow_down: |
   | [superset/charts/data/commands/get\_data\_command.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvY29tbWFuZHMvZ2V0X2RhdGFfY29tbWFuZC5weQ==) | `96.96% <87.50%> (-3.04%)` | :arrow_down: |
   | [superset/charts/data/query\_context\_validator.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvcXVlcnlfY29udGV4dF92YWxpZGF0b3IucHk=) | `89.28% <89.28%> (ø)` | |
   | [superset/charts/data/api.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvYXBpLnB5) | `88.38% <100.00%> (+0.30%)` | :arrow_up: |
   | [superset/security/manager.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc2VjdXJpdHkvbWFuYWdlci5weQ==) | `91.90% <100.00%> (+0.06%)` | :arrow_up: |
   | [superset/db\_engines/hive.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lcy9oaXZlLnB5) | `0.00% <0.00%> (-85.19%)` | :arrow_down: |
   | [superset/db\_engine\_specs/hive.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2hpdmUucHk=) | `69.49% <0.00%> (-16.99%)` | :arrow_down: |
   | ... and [14 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [16e012f...c451abf](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9033a1d) into [master](https://codecov.io/gh/apache/superset/commit/16e012fe5d791ed6aa5ab755a6386b1581fc5ebd?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (16e012f) will **decrease** coverage by `0.14%`.
   > The diff coverage is `73.46%`.
   
   > :exclamation: Current head 9033a1d differs from pull request most recent head c451abf. Consider uploading reports for the commit c451abf to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   - Coverage   76.95%   76.80%   -0.15%     
   ==========================================
     Files        1047     1050       +3     
     Lines       56498    56804     +306     
     Branches     7798     7851      +53     
   ==========================================
   + Hits        43476    43628     +152     
   - Misses      12766    12923     +157     
   + Partials      256      253       -3     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `82.02% <ø> (?)` | |
   | postgres | `82.02% <ø> (+0.02%)` | :arrow_up: |
   | presto | `?` | |
   | python | `82.11% <ø> (-0.32%)` | :arrow_down: |
   | sqlite | `81.71% <ø> (?)` | |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset-frontend/src/SqlLab/actions/sqlLab.js](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9hY3Rpb25zL3NxbExhYi5qcw==) | `58.69% <0.00%> (ø)` | |
   | [...erset-frontend/src/SqlLab/components/App/index.jsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL0FwcC9pbmRleC5qc3g=) | `56.66% <ø> (ø)` | |
   | [...frontend/src/SqlLab/components/ResultSet/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1Jlc3VsdFNldC9pbmRleC50c3g=) | `61.48% <ø> (ø)` | |
   | [...c/SqlLab/components/TemplateParamsEditor/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1RlbXBsYXRlUGFyYW1zRWRpdG9yL2luZGV4LnRzeA==) | `88.88% <ø> (ø)` | |
   | [...uperset-frontend/src/components/Menu/MenuRight.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvTWVudS9NZW51UmlnaHQudHN4) | `92.30% <ø> (ø)` | |
   | [...rontend/src/components/Select/DeprecatedSelect.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L0RlcHJlY2F0ZWRTZWxlY3QudHN4) | `63.63% <ø> (-1.07%)` | :arrow_down: |
   | [...end/src/components/Select/WindowedSelect/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L1dpbmRvd2VkU2VsZWN0L2luZGV4LnRzeA==) | `100.00% <ø> (ø)` | |
   | [...t-frontend/src/dashboard/actions/dashboardState.js](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9hY3Rpb25zL2Rhc2hib2FyZFN0YXRlLmpz) | `28.80% <0.00%> (-0.16%)` | :arrow_down: |
   | [...t-frontend/src/dashboard/components/SliceAdder.jsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlQWRkZXIuanN4) | `76.62% <ø> (ø)` | |
   | [...dashboard/components/SliceHeaderControls/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlSGVhZGVyQ29udHJvbHMvaW5kZXgudHN4) | `75.38% <0.00%> (ø)` | |
   | ... and [133 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [16e012f...c451abf](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] ofekisr commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
ofekisr commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r758479784



##########
File path: superset/security/manager.py
##########
@@ -14,8 +14,10 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines, invalid-name

Review comment:
       I don't think we should use the invalid-name rule as well... 
   I use the clean code principles, so there is no sense to put ignoring on each statement 




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


[GitHub] [superset] villebro commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
villebro commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r759115014



##########
File path: superset/charts/data/commands/get_data_command.py
##########
@@ -14,6 +14,8 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+from __future__ import annotations
+

Review comment:
       > https://docs.python.org/3/library/__future__.html
   > you should add it until all supported versions are at least 3.11
   > I use that future for the type hints
   
   Thanks for the heads up, I hadn't seen this PEP, and I agree with the change. Ugh, not looking forward to seeing `__future__` all around the codebase again 😖 but I agree it's cleaner than having string-based type references.




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


[GitHub] [superset] codecov[bot] commented on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e7b3539) into [master](https://codecov.io/gh/apache/superset/commit/9a8911f18c519ee80e46fdaec669ed3b26141b2f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9a8911f) will **decrease** coverage by `0.18%`.
   > The diff coverage is `43.75%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   - Coverage   76.85%   76.66%   -0.19%     
   ==========================================
     Files        1030     1031       +1     
     Lines       55017    55152     +135     
     Branches     7464     7464              
   ==========================================
   + Hits        42282    42283       +1     
   - Misses      12482    12616     +134     
     Partials      253      253              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `81.77% <43.75%> (-0.06%)` | :arrow_down: |
   | postgres | `81.78% <43.75%> (-0.12%)` | :arrow_down: |
   | python | `81.86% <43.75%> (-0.39%)` | :arrow_down: |
   | sqlite | `81.45% <43.75%> (-0.06%)` | :arrow_down: |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/common/query\_context.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2NvbnRleHQucHk=) | `88.93% <16.66%> (-1.98%)` | :arrow_down: |
   | [superset/common/query\_object.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X29iamVjdC5weQ==) | `90.75% <20.00%> (-2.11%)` | :arrow_down: |
   | [...uperset/charts/commands/query\_context\_validator.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2NvbW1hbmRzL3F1ZXJ5X2NvbnRleHRfdmFsaWRhdG9yLnB5) | `34.17% <34.17%> (ø)` | |
   | [superset/datasets/dao.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvZGFvLnB5) | `95.89% <66.66%> (-0.62%)` | :arrow_down: |
   | [superset/charts/commands/data.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2NvbW1hbmRzL2RhdGEucHk=) | `95.08% <85.71%> (-1.29%)` | :arrow_down: |
   | [superset/charts/api.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2FwaS5weQ==) | `85.97% <100.00%> (+0.14%)` | :arrow_up: |
   | [superset/tasks/async\_queries.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdGFza3MvYXN5bmNfcXVlcmllcy5weQ==) | `97.14% <100.00%> (+0.17%)` | :arrow_up: |
   | [superset/db\_engines/hive.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lcy9oaXZlLnB5) | `0.00% <0.00%> (-82.15%)` | :arrow_down: |
   | [superset/db\_engine\_specs/hive.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2hpdmUucHk=) | `69.76% <0.00%> (-17.06%)` | :arrow_down: |
   | [superset/views/database/mixins.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvbWl4aW5zLnB5) | `81.03% <0.00%> (-1.73%)` | :arrow_down: |
   | ... and [11 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [9a8911f...e7b3539](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] craig-rueda commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
craig-rueda commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r732100371



##########
File path: superset/charts/commands/query_context_validator.py
##########
@@ -0,0 +1,168 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# pylint: disable=invalid-name, no-self-use, too-few-public-methods
+from __future__ import annotations
+
+from typing import List, Optional, Set, TYPE_CHECKING
+
+from superset.charts.commands.data import QueryContextValidator
+from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
+from superset.exceptions import SupersetSecurityException
+from superset.sql_parse import ParsedQuery, Table
+
+if TYPE_CHECKING:
+    from superset import SupersetSecurityManager
+    from superset.connectors.sqla.models import SqlaTable
+    from superset.datasets.dao import DatasetDAO
+    from superset.models.core import Database
+    from superset.common.query_object import QueryObject
+    from superset.connectors.base.models import BaseDatasource
+    from superset.common.query_context import QueryContext
+    from superset.typing import Metric
+
+
+class QueryContextValidatorImpl(QueryContextValidator):
+    _dataset_dao: DatasetDAO
+    _security_manager: SupersetSecurityManager
+
+    def __init__(
+        self, dataset_dao: DatasetDAO, security_manager: SupersetSecurityManager
+    ):
+        self._dataset_dao = dataset_dao
+        self._security_manager = security_manager
+
+    def validate(self, query_context: QueryContext) -> None:
+        self._validate_actor_can_access(query_context)
+        self._validate_queries_context(query_context)
+
+    def _validate_actor_can_access(self, query_context: QueryContext) -> None:
+        sql_database: Optional[Database] = query_context.get_database()
+        if sql_database is not None:
+            self._validate_when_context_based_on_sql_database(
+                query_context, sql_database
+            )
+        else:

Review comment:
       Shouldn't we just always call `raise_for_access()`? I see this thing as needing an extra check when the sql_db is not 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


[GitHub] [superset] amitmiran137 commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
amitmiran137 commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r732125966



##########
File path: superset/charts/api.py
##########
@@ -617,7 +619,7 @@ def get_data(self, pk: int) -> Response:
         json_body["result_type"] = request.args.get("type", ChartDataResultType.FULL)
 
         try:
-            command = ChartDataCommand()
+            command = self._create_chart_data_command()

Review comment:
       as a preparation for a ChartDataCommandFactory for all instantiations




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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c430381) into [master](https://codecov.io/gh/apache/superset/commit/16e012fe5d791ed6aa5ab755a6386b1581fc5ebd?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (16e012f) will **decrease** coverage by `8.53%`.
   > The diff coverage is `87.79%`.
   
   > :exclamation: Current head c430381 differs from pull request most recent head 90dbeaf. Consider uploading reports for the commit 90dbeaf to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   - Coverage   76.95%   68.42%   -8.54%     
   ==========================================
     Files        1047     1590     +543     
     Lines       56498    65082    +8584     
     Branches     7798     6963     -835     
   ==========================================
   + Hits        43476    44530    +1054     
   - Misses      12766    18662    +5896     
   - Partials      256     1890    +1634     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `82.04% <ø> (?)` | |
   | postgres | `82.05% <ø> (+0.05%)` | :arrow_up: |
   | presto | `?` | |
   | python | `82.09% <ø> (-0.33%)` | :arrow_down: |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [.../superset-ui-core/src/query/types/QueryFormData.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvUXVlcnlGb3JtRGF0YS50cw==) | `87.50% <ø> (ø)` | |
   | [.../superset-ui-core/src/query/types/QueryResponse.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvUXVlcnlSZXNwb25zZS50cw==) | `100.00% <ø> (ø)` | |
   | [.../packages/superset-ui-core/src/query/types/Time.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvVGltZS50cw==) | `100.00% <ø> (ø)` | |
   | [...packages/superset-ui-core/src/query/types/index.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvaW5kZXgudHM=) | `100.00% <ø> (ø)` | |
   | [...tend/packages/superset-ui-core/src/style/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvc3R5bGUvaW5kZXgudHN4) | `100.00% <ø> (ø)` | |
   | [...es/superset-ui-core/src/time-format/TimeFormats.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHMudHM=) | `100.00% <ø> (ø)` | |
   | [...-core/src/time-format/TimeFormatsForGranularity.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHNGb3JHcmFudWxhcml0eS50cw==) | `100.00% <ø> (ø)` | |
   | [.../superset-ui-core/src/time-format/TimeFormatter.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHRlci50cw==) | `95.23% <ø> (ø)` | |
   | [...t-ui-core/src/time-format/TimeFormatterRegistry.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHRlclJlZ2lzdHJ5LnRz) | `94.11% <ø> (ø)` | |
   | [.../src/time-format/TimeFormatterRegistrySingleton.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHRlclJlZ2lzdHJ5U2luZ2xldG9uLnRz) | `85.71% <ø> (ø)` | |
   | ... and [1132 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [16e012f...90dbeaf](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] ofekisr commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
ofekisr commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r759114063



##########
File path: superset/security/manager.py
##########
@@ -974,14 +976,14 @@ def set_perm(  # pylint: disable=unused-argument
                 )
 
     def raise_for_access(
-        # pylint: disable=too-many-arguments,too-many-locals
+        # pylint: disable=too-many-arguments
         self,
-        database: Optional["Database"] = None,
-        datasource: Optional["BaseDatasource"] = None,
-        query: Optional["Query"] = None,
-        query_context: Optional["QueryContext"] = None,
-        table: Optional["Table"] = None,
-        viz: Optional["BaseViz"] = None,
+        database: Optional[Database] = None,
+        datasource: Optional[BaseDatasource] = None,
+        query: Optional[Query] = None,
+        query_context: Optional[QueryContext] = None,
+        table: Optional[Table] = None,
+        viz: Optional[BaseViz] = None,

Review comment:
       > 
   When you use the old method of type hint as string, you actually don't need to import the class at all and don't need to put it under TYPE_CHECKING
   but if you would like to use the new better choice for marking the type hint by the real type 
   you should import them under TYPE_CHECKING with the __future__ annotations.
   That is the better choice so you can navigate and let the IDEs do their job --> assist you 
   
   




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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e7b3539) into [master](https://codecov.io/gh/apache/superset/commit/9a8911f18c519ee80e46fdaec669ed3b26141b2f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9a8911f) will **decrease** coverage by `0.18%`.
   > The diff coverage is `43.75%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   - Coverage   76.85%   76.66%   -0.19%     
   ==========================================
     Files        1030     1031       +1     
     Lines       55017    55152     +135     
     Branches     7464     7464              
   ==========================================
   + Hits        42282    42283       +1     
   - Misses      12482    12616     +134     
     Partials      253      253              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `81.77% <43.75%> (-0.06%)` | :arrow_down: |
   | postgres | `81.78% <43.75%> (-0.12%)` | :arrow_down: |
   | python | `81.86% <43.75%> (-0.39%)` | :arrow_down: |
   | sqlite | `81.45% <43.75%> (-0.06%)` | :arrow_down: |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/common/query\_context.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2NvbnRleHQucHk=) | `88.93% <16.66%> (-1.98%)` | :arrow_down: |
   | [superset/common/query\_object.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X29iamVjdC5weQ==) | `90.75% <20.00%> (-2.11%)` | :arrow_down: |
   | [...uperset/charts/commands/query\_context\_validator.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2NvbW1hbmRzL3F1ZXJ5X2NvbnRleHRfdmFsaWRhdG9yLnB5) | `34.17% <34.17%> (ø)` | |
   | [superset/datasets/dao.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvZGFvLnB5) | `95.89% <66.66%> (-0.62%)` | :arrow_down: |
   | [superset/charts/commands/data.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2NvbW1hbmRzL2RhdGEucHk=) | `95.08% <85.71%> (-1.29%)` | :arrow_down: |
   | [superset/charts/api.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2FwaS5weQ==) | `85.97% <100.00%> (+0.14%)` | :arrow_up: |
   | [superset/tasks/async\_queries.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdGFza3MvYXN5bmNfcXVlcmllcy5weQ==) | `97.14% <100.00%> (+0.17%)` | :arrow_up: |
   | [superset/db\_engines/hive.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lcy9oaXZlLnB5) | `0.00% <0.00%> (-82.15%)` | :arrow_down: |
   | [superset/db\_engine\_specs/hive.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2hpdmUucHk=) | `69.76% <0.00%> (-17.06%)` | :arrow_down: |
   | [superset/views/database/mixins.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvbWl4aW5zLnB5) | `81.03% <0.00%> (-1.73%)` | :arrow_down: |
   | ... and [11 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [9a8911f...e7b3539](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] ofekisr commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
ofekisr commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r759096744



##########
File path: superset/security/manager.py
##########
@@ -14,8 +14,10 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines, invalid-name

Review comment:
       I'll add and open new discussion on it




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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (66ac874) into [master](https://codecov.io/gh/apache/superset/commit/f8a65f8001a5069ab53ce9295fb378abec66dc90?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f8a65f8) will **increase** coverage by `1.33%`.
   > The diff coverage is `86.45%`.
   
   > :exclamation: Current head 66ac874 differs from pull request most recent head 9d8d6f4. Consider uploading reports for the commit 9d8d6f4 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   + Coverage   67.10%   68.43%   +1.33%     
   ==========================================
     Files        1609     1590      -19     
     Lines       64897    65082     +185     
     Branches     6866     6963      +97     
   ==========================================
   + Hits        43547    44542     +995     
   + Misses      19484    18650     -834     
   - Partials     1866     1890      +24     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `82.04% <86.45%> (-0.15%)` | :arrow_down: |
   | postgres | `82.05% <86.45%> (-0.20%)` | :arrow_down: |
   | presto | `?` | |
   | python | `82.13% <86.45%> (-0.60%)` | :arrow_down: |
   | sqlite | `81.73% <86.45%> (-0.20%)` | :arrow_down: |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/config.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29uZmlnLnB5) | `91.53% <ø> (-0.11%)` | :arrow_down: |
   | [superset/common/query\_object.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X29iamVjdC5weQ==) | `92.13% <60.00%> (-3.50%)` | :arrow_down: |
   | [superset/datasets/dao.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvZGFvLnB5) | `93.24% <66.66%> (-0.55%)` | :arrow_down: |
   | [superset/common/query\_context.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2NvbnRleHQucHk=) | `86.15% <77.27%> (-6.58%)` | :arrow_down: |
   | [superset/tasks/async\_queries.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdGFza3MvYXN5bmNfcXVlcmllcy5weQ==) | `90.24% <83.33%> (-0.79%)` | :arrow_down: |
   | [...set/charts/data/query\_context\_validator\_factory.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvcXVlcnlfY29udGV4dF92YWxpZGF0b3JfZmFjdG9yeS5weQ==) | `85.71% <85.71%> (ø)` | |
   | [superset/charts/data/commands/get\_data\_command.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvY29tbWFuZHMvZ2V0X2RhdGFfY29tbWFuZC5weQ==) | `96.96% <87.50%> (-3.04%)` | :arrow_down: |
   | [superset/charts/data/query\_context\_validator.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvcXVlcnlfY29udGV4dF92YWxpZGF0b3IucHk=) | `89.41% <89.41%> (ø)` | |
   | [superset/charts/data/api.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvYXBpLnB5) | `88.31% <100.00%> (-0.51%)` | :arrow_down: |
   | [superset/security/manager.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc2VjdXJpdHkvbWFuYWdlci5weQ==) | `91.92% <100.00%> (-0.05%)` | :arrow_down: |
   | ... and [660 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [f8a65f8...9d8d6f4](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] ofekisr commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
ofekisr commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r758477438



##########
File path: superset/charts/data/commands/get_data_command.py
##########
@@ -14,6 +14,8 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+from __future__ import annotations
+

Review comment:
       I develop with py 3.8, without it raises errors




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


[GitHub] [superset] betodealmeida commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
betodealmeida commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r758527587



##########
File path: superset/security/manager.py
##########
@@ -1047,17 +1048,23 @@ def raise_for_access(
 
             assert datasource
 
-            if not (
-                self.can_access_schema(datasource)
-                or self.can_access("datasource_access", datasource.perm or "")
-                or (
-                    feature_flag_manager.is_feature_enabled("DASHBOARD_RBAC")
-                    and self.can_access_based_on_dashboard(datasource)
-                )
-            ):
-                raise SupersetSecurityException(
-                    self.get_datasource_access_error_object(datasource)
-                )
+            self.raise_when_there_is_no_access_to(datasource)
+
+    def raise_when_there_is_no_access_to(self, datasource: BaseDatasource) -> None:

Review comment:
       We can discuss which naming strategy is better, but I think we can all agree that consistency is a good thing. If we have an existing pattern I think it would be better to stick with it, since it makes it easier for people to understand the code.




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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (fb7bfa2) into [master](https://codecov.io/gh/apache/superset/commit/16e012fe5d791ed6aa5ab755a6386b1581fc5ebd?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (16e012f) will **decrease** coverage by `0.16%`.
   > The diff coverage is `85.91%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   - Coverage   76.95%   76.78%   -0.17%     
   ==========================================
     Files        1047     1048       +1     
     Lines       56498    56620     +122     
     Branches     7798     7798              
   ==========================================
   + Hits        43476    43477       +1     
   - Misses      12766    12887     +121     
     Partials      256      256              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `81.98% <85.91%> (?)` | |
   | postgres | `81.99% <85.91%> (-0.01%)` | :arrow_down: |
   | presto | `?` | |
   | python | `82.08% <85.91%> (-0.34%)` | :arrow_down: |
   | sqlite | `81.67% <85.91%> (?)` | |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/common/query\_object.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X29iamVjdC5weQ==) | `92.13% <60.00%> (-0.93%)` | :arrow_down: |
   | [superset/datasets/dao.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvZGFvLnB5) | `93.24% <66.66%> (-0.55%)` | :arrow_down: |
   | [superset/common/query\_context.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2NvbnRleHQucHk=) | `84.61% <72.72%> (-7.84%)` | :arrow_down: |
   | [superset/tasks/async\_queries.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdGFza3MvYXN5bmNfcXVlcmllcy5weQ==) | `90.36% <85.71%> (-0.67%)` | :arrow_down: |
   | [superset/charts/data/commands/get\_data\_command.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvY29tbWFuZHMvZ2V0X2RhdGFfY29tbWFuZC5weQ==) | `96.96% <87.50%> (-3.04%)` | :arrow_down: |
   | [superset/charts/data/query\_context\_validator.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvcXVlcnlfY29udGV4dF92YWxpZGF0b3IucHk=) | `89.28% <89.28%> (ø)` | |
   | [superset/charts/data/api.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvYXBpLnB5) | `88.38% <100.00%> (+0.30%)` | :arrow_up: |
   | [superset/security/manager.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc2VjdXJpdHkvbWFuYWdlci5weQ==) | `91.90% <100.00%> (+0.06%)` | :arrow_up: |
   | [superset/db\_engines/hive.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lcy9oaXZlLnB5) | `0.00% <0.00%> (-85.19%)` | :arrow_down: |
   | [superset/db\_engine\_specs/hive.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2hpdmUucHk=) | `69.49% <0.00%> (-16.99%)` | :arrow_down: |
   | ... and [14 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [16e012f...fb7bfa2](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (66ac874) into [master](https://codecov.io/gh/apache/superset/commit/aee5c9a3ea1006b194319d47c3e7f245e438ce6f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (aee5c9a) will **decrease** coverage by `0.44%`.
   > The diff coverage is `86.45%`.
   
   > :exclamation: Current head 66ac874 differs from pull request most recent head 3d204e6. Consider uploading reports for the commit 3d204e6 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   - Coverage   68.88%   68.43%   -0.45%     
   ==========================================
     Files        1598     1590       -8     
     Lines       65297    65082     -215     
     Branches     6952     6963      +11     
   ==========================================
   - Hits        44978    44542     -436     
   - Misses      18434    18650     +216     
   - Partials     1885     1890       +5     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `82.04% <86.45%> (-0.10%)` | :arrow_down: |
   | postgres | `82.05% <86.45%> (-0.10%)` | :arrow_down: |
   | python | `82.13% <86.45%> (-0.36%)` | :arrow_down: |
   | sqlite | `81.73% <86.45%> (-0.10%)` | :arrow_down: |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/config.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29uZmlnLnB5) | `91.53% <ø> (-0.06%)` | :arrow_down: |
   | [superset/common/query\_object.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X29iamVjdC5weQ==) | `92.13% <60.00%> (-0.93%)` | :arrow_down: |
   | [superset/datasets/dao.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvZGFvLnB5) | `93.24% <66.66%> (-0.55%)` | :arrow_down: |
   | [superset/common/query\_context.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2NvbnRleHQucHk=) | `86.15% <77.27%> (-6.58%)` | :arrow_down: |
   | [superset/tasks/async\_queries.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdGFza3MvYXN5bmNfcXVlcmllcy5weQ==) | `90.24% <83.33%> (-0.79%)` | :arrow_down: |
   | [...set/charts/data/query\_context\_validator\_factory.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvcXVlcnlfY29udGV4dF92YWxpZGF0b3JfZmFjdG9yeS5weQ==) | `85.71% <85.71%> (ø)` | |
   | [superset/charts/data/commands/get\_data\_command.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvY29tbWFuZHMvZ2V0X2RhdGFfY29tbWFuZC5weQ==) | `96.96% <87.50%> (-3.04%)` | :arrow_down: |
   | [superset/charts/data/query\_context\_validator.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvcXVlcnlfY29udGV4dF92YWxpZGF0b3IucHk=) | `89.41% <89.41%> (ø)` | |
   | [superset/charts/data/api.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvYXBpLnB5) | `88.31% <100.00%> (+0.15%)` | :arrow_up: |
   | [superset/security/manager.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc2VjdXJpdHkvbWFuYWdlci5weQ==) | `91.92% <100.00%> (-0.05%)` | :arrow_down: |
   | ... and [80 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [aee5c9a...3d204e6](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] ofekisr commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
ofekisr commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r732141563



##########
File path: superset/charts/api.py
##########
@@ -617,7 +619,7 @@ def get_data(self, pk: int) -> Response:
         json_body["result_type"] = request.args.get("type", ChartDataResultType.FULL)
 
         try:
-            command = ChartDataCommand()
+            command = self._create_chart_data_command()

Review comment:
       > is there a specific reason why we are wrapping the chart command in a private function?
   
   1. Prevent reuse code
   2. The way the command is created is not the function task, SRP,
   3. The one who follows the code, don't care how the command is creates he just want to get the command and run it, if it still interested it steps into the private method




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


[GitHub] [superset] craig-rueda commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
craig-rueda commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r758602612



##########
File path: superset/charts/data/query_context_validator.py
##########
@@ -0,0 +1,168 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# pylint: disable=invalid-name, no-self-use, too-few-public-methods
+from __future__ import annotations
+
+from typing import List, Optional, Set, TYPE_CHECKING
+
+from superset.charts.data.commands.get_data_command import QueryContextValidator
+from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
+from superset.exceptions import SupersetSecurityException
+from superset.sql_parse import ParsedQuery, Table
+
+if TYPE_CHECKING:
+    from superset import SupersetSecurityManager
+    from superset.common.query_context import QueryContext
+    from superset.common.query_object import QueryObject
+    from superset.connectors.base.models import BaseDatasource
+    from superset.connectors.sqla.models import SqlaTable
+    from superset.datasets.dao import DatasetDAO
+    from superset.models.core import Database
+    from superset.typing import Metric
+
+
+class QueryContextValidatorImpl(QueryContextValidator):
+    _dataset_dao: DatasetDAO
+    _security_manager: SupersetSecurityManager
+
+    def __init__(
+        self, dataset_dao: DatasetDAO, security_manager: SupersetSecurityManager
+    ):
+        self._dataset_dao = dataset_dao
+        self._security_manager = security_manager
+
+    def validate(self, query_context: QueryContext) -> None:
+        self._validate_actor_can_access(query_context)
+        self._validate_queries_context(query_context)
+
+    def _validate_actor_can_access(self, query_context: QueryContext) -> None:
+        sql_database: Optional[Database] = query_context.get_database()
+        if sql_database is not None:
+            self._validate_when_context_based_on_sql_database(
+                query_context, sql_database
+            )
+        else:
+            self._security_manager.raise_for_access(query_context=query_context)
+
+    def _validate_when_context_based_on_sql_database(

Review comment:
       Yep, I agree. Too much delegation makes the logic flow hard to follow




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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9033a1d) into [master](https://codecov.io/gh/apache/superset/commit/16e012fe5d791ed6aa5ab755a6386b1581fc5ebd?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (16e012f) will **increase** coverage by `0.06%`.
   > The diff coverage is `73.46%`.
   
   > :exclamation: Current head 9033a1d differs from pull request most recent head 44d25d0. Consider uploading reports for the commit 44d25d0 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   + Coverage   76.95%   77.01%   +0.06%     
   ==========================================
     Files        1047     1050       +3     
     Lines       56498    56804     +306     
     Branches     7798     7851      +53     
   ==========================================
   + Hits        43476    43750     +274     
   - Misses      12766    12801      +35     
   + Partials      256      253       -3     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `81.60% <ø> (+0.03%)` | :arrow_up: |
   | mysql | `82.02% <ø> (?)` | |
   | postgres | `82.03% <ø> (+0.03%)` | :arrow_up: |
   | presto | `81.90% <ø> (+0.03%)` | :arrow_up: |
   | python | `82.52% <ø> (+0.10%)` | :arrow_up: |
   | sqlite | `81.71% <ø> (?)` | |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset-frontend/src/SqlLab/actions/sqlLab.js](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9hY3Rpb25zL3NxbExhYi5qcw==) | `58.69% <0.00%> (ø)` | |
   | [...erset-frontend/src/SqlLab/components/App/index.jsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL0FwcC9pbmRleC5qc3g=) | `56.66% <ø> (ø)` | |
   | [...frontend/src/SqlLab/components/ResultSet/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1Jlc3VsdFNldC9pbmRleC50c3g=) | `61.48% <ø> (ø)` | |
   | [...c/SqlLab/components/TemplateParamsEditor/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1RlbXBsYXRlUGFyYW1zRWRpdG9yL2luZGV4LnRzeA==) | `88.88% <ø> (ø)` | |
   | [...uperset-frontend/src/components/Menu/MenuRight.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvTWVudS9NZW51UmlnaHQudHN4) | `92.30% <ø> (ø)` | |
   | [...rontend/src/components/Select/DeprecatedSelect.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L0RlcHJlY2F0ZWRTZWxlY3QudHN4) | `63.63% <ø> (-1.07%)` | :arrow_down: |
   | [...end/src/components/Select/WindowedSelect/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L1dpbmRvd2VkU2VsZWN0L2luZGV4LnRzeA==) | `100.00% <ø> (ø)` | |
   | [...t-frontend/src/dashboard/actions/dashboardState.js](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9hY3Rpb25zL2Rhc2hib2FyZFN0YXRlLmpz) | `28.80% <0.00%> (-0.16%)` | :arrow_down: |
   | [...t-frontend/src/dashboard/components/SliceAdder.jsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlQWRkZXIuanN4) | `76.62% <ø> (ø)` | |
   | [...dashboard/components/SliceHeaderControls/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlSGVhZGVyQ29udHJvbHMvaW5kZXgudHN4) | `75.38% <0.00%> (ø)` | |
   | ... and [127 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [16e012f...44d25d0](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (66ac874) into [master](https://codecov.io/gh/apache/superset/commit/aee5c9a3ea1006b194319d47c3e7f245e438ce6f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (aee5c9a) will **decrease** coverage by `0.44%`.
   > The diff coverage is `86.45%`.
   
   > :exclamation: Current head 66ac874 differs from pull request most recent head 98e7b63. Consider uploading reports for the commit 98e7b63 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   - Coverage   68.88%   68.43%   -0.45%     
   ==========================================
     Files        1598     1590       -8     
     Lines       65297    65082     -215     
     Branches     6952     6963      +11     
   ==========================================
   - Hits        44978    44542     -436     
   - Misses      18434    18650     +216     
   - Partials     1885     1890       +5     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `82.04% <86.45%> (-0.10%)` | :arrow_down: |
   | postgres | `82.05% <86.45%> (-0.10%)` | :arrow_down: |
   | python | `82.13% <86.45%> (-0.36%)` | :arrow_down: |
   | sqlite | `81.73% <86.45%> (-0.10%)` | :arrow_down: |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/config.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29uZmlnLnB5) | `91.53% <ø> (-0.06%)` | :arrow_down: |
   | [superset/common/query\_object.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X29iamVjdC5weQ==) | `92.13% <60.00%> (-0.93%)` | :arrow_down: |
   | [superset/datasets/dao.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvZGFvLnB5) | `93.24% <66.66%> (-0.55%)` | :arrow_down: |
   | [superset/common/query\_context.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2NvbnRleHQucHk=) | `86.15% <77.27%> (-6.58%)` | :arrow_down: |
   | [superset/tasks/async\_queries.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdGFza3MvYXN5bmNfcXVlcmllcy5weQ==) | `90.24% <83.33%> (-0.79%)` | :arrow_down: |
   | [...set/charts/data/query\_context\_validator\_factory.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvcXVlcnlfY29udGV4dF92YWxpZGF0b3JfZmFjdG9yeS5weQ==) | `85.71% <85.71%> (ø)` | |
   | [superset/charts/data/commands/get\_data\_command.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvY29tbWFuZHMvZ2V0X2RhdGFfY29tbWFuZC5weQ==) | `96.96% <87.50%> (-3.04%)` | :arrow_down: |
   | [superset/charts/data/query\_context\_validator.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvcXVlcnlfY29udGV4dF92YWxpZGF0b3IucHk=) | `89.41% <89.41%> (ø)` | |
   | [superset/charts/data/api.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvYXBpLnB5) | `88.31% <100.00%> (+0.15%)` | :arrow_up: |
   | [superset/security/manager.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc2VjdXJpdHkvbWFuYWdlci5weQ==) | `91.92% <100.00%> (-0.05%)` | :arrow_down: |
   | ... and [80 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [aee5c9a...98e7b63](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9033a1d) into [master](https://codecov.io/gh/apache/superset/commit/16e012fe5d791ed6aa5ab755a6386b1581fc5ebd?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (16e012f) will **decrease** coverage by `0.00%`.
   > The diff coverage is `73.46%`.
   
   > :exclamation: Current head 9033a1d differs from pull request most recent head c451abf. Consider uploading reports for the commit c451abf to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   - Coverage   76.95%   76.94%   -0.01%     
   ==========================================
     Files        1047     1050       +3     
     Lines       56498    56804     +306     
     Branches     7798     7851      +53     
   ==========================================
   + Hits        43476    43708     +232     
   - Misses      12766    12843      +77     
   + Partials      256      253       -3     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `81.60% <ø> (+0.03%)` | :arrow_up: |
   | mysql | `82.02% <ø> (?)` | |
   | postgres | `82.03% <ø> (+0.03%)` | :arrow_up: |
   | presto | `?` | |
   | python | `82.38% <ø> (-0.05%)` | :arrow_down: |
   | sqlite | `81.71% <ø> (?)` | |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset-frontend/src/SqlLab/actions/sqlLab.js](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9hY3Rpb25zL3NxbExhYi5qcw==) | `58.69% <0.00%> (ø)` | |
   | [...erset-frontend/src/SqlLab/components/App/index.jsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL0FwcC9pbmRleC5qc3g=) | `56.66% <ø> (ø)` | |
   | [...frontend/src/SqlLab/components/ResultSet/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1Jlc3VsdFNldC9pbmRleC50c3g=) | `61.48% <ø> (ø)` | |
   | [...c/SqlLab/components/TemplateParamsEditor/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1RlbXBsYXRlUGFyYW1zRWRpdG9yL2luZGV4LnRzeA==) | `88.88% <ø> (ø)` | |
   | [...uperset-frontend/src/components/Menu/MenuRight.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvTWVudS9NZW51UmlnaHQudHN4) | `92.30% <ø> (ø)` | |
   | [...rontend/src/components/Select/DeprecatedSelect.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L0RlcHJlY2F0ZWRTZWxlY3QudHN4) | `63.63% <ø> (-1.07%)` | :arrow_down: |
   | [...end/src/components/Select/WindowedSelect/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L1dpbmRvd2VkU2VsZWN0L2luZGV4LnRzeA==) | `100.00% <ø> (ø)` | |
   | [...t-frontend/src/dashboard/actions/dashboardState.js](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9hY3Rpb25zL2Rhc2hib2FyZFN0YXRlLmpz) | `28.80% <0.00%> (-0.16%)` | :arrow_down: |
   | [...t-frontend/src/dashboard/components/SliceAdder.jsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlQWRkZXIuanN4) | `76.62% <ø> (ø)` | |
   | [...dashboard/components/SliceHeaderControls/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlSGVhZGVyQ29udHJvbHMvaW5kZXgudHN4) | `75.38% <0.00%> (ø)` | |
   | ... and [127 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [16e012f...c451abf](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] codecov[bot] commented on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e7b3539) into [master](https://codecov.io/gh/apache/superset/commit/9a8911f18c519ee80e46fdaec669ed3b26141b2f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9a8911f) will **decrease** coverage by `0.18%`.
   > The diff coverage is `43.75%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   - Coverage   76.85%   76.66%   -0.19%     
   ==========================================
     Files        1030     1031       +1     
     Lines       55017    55152     +135     
     Branches     7464     7464              
   ==========================================
   + Hits        42282    42283       +1     
   - Misses      12482    12616     +134     
     Partials      253      253              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `81.77% <43.75%> (-0.06%)` | :arrow_down: |
   | postgres | `81.78% <43.75%> (-0.12%)` | :arrow_down: |
   | python | `81.86% <43.75%> (-0.39%)` | :arrow_down: |
   | sqlite | `81.45% <43.75%> (-0.06%)` | :arrow_down: |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/common/query\_context.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2NvbnRleHQucHk=) | `88.93% <16.66%> (-1.98%)` | :arrow_down: |
   | [superset/common/query\_object.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X29iamVjdC5weQ==) | `90.75% <20.00%> (-2.11%)` | :arrow_down: |
   | [...uperset/charts/commands/query\_context\_validator.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2NvbW1hbmRzL3F1ZXJ5X2NvbnRleHRfdmFsaWRhdG9yLnB5) | `34.17% <34.17%> (ø)` | |
   | [superset/datasets/dao.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvZGFvLnB5) | `95.89% <66.66%> (-0.62%)` | :arrow_down: |
   | [superset/charts/commands/data.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2NvbW1hbmRzL2RhdGEucHk=) | `95.08% <85.71%> (-1.29%)` | :arrow_down: |
   | [superset/charts/api.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2FwaS5weQ==) | `85.97% <100.00%> (+0.14%)` | :arrow_up: |
   | [superset/tasks/async\_queries.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdGFza3MvYXN5bmNfcXVlcmllcy5weQ==) | `97.14% <100.00%> (+0.17%)` | :arrow_up: |
   | [superset/db\_engines/hive.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lcy9oaXZlLnB5) | `0.00% <0.00%> (-82.15%)` | :arrow_down: |
   | [superset/db\_engine\_specs/hive.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2hpdmUucHk=) | `69.76% <0.00%> (-17.06%)` | :arrow_down: |
   | [superset/views/database/mixins.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvbWl4aW5zLnB5) | `81.03% <0.00%> (-1.73%)` | :arrow_down: |
   | ... and [11 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [9a8911f...e7b3539](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] betodealmeida commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
betodealmeida commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r758526754



##########
File path: superset/security/manager.py
##########
@@ -14,8 +14,10 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines, invalid-name

Review comment:
       Putting on each statement means you're aware of the rule, and you consciously decided to break it because practicality beats purity. If you put it at the top of the model the rule could be broken many times without people being aware of it, which reduces the code quality.




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


[GitHub] [superset] villebro commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
villebro commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r759106982



##########
File path: superset/charts/data/commands/get_data_command.py
##########
@@ -14,6 +14,8 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+from __future__ import annotations
+

Review comment:
       @ofekisr My point for introducing the FF is to gradually introduce the new stricter security check in a way which makes it possible to catch potential regressions that weren't caught during initial review. By having an introductory period during which the stricter checks are behind a FF, orgs that require the new stricter checking can help harden the feature by pushing fixes to master before the new checks are made generally available.




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


[GitHub] [superset] amitmiran137 commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
amitmiran137 commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r724423651



##########
File path: superset/charts/commands/query_context_validator.py
##########
@@ -0,0 +1,150 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# pylint: disable=invalid-name, no-self-use, too-few-public-methods
+from __future__ import annotations
+
+from typing import List, Optional, Set, TYPE_CHECKING
+
+from superset.charts.commands.data import QueryContextValidator
+from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
+from superset.exceptions import SupersetSecurityException
+from superset.sql_parse import ParsedQuery, Table
+
+if TYPE_CHECKING:
+    from superset import SupersetSecurityManager
+    from superset.connectors.sqla.models import SqlaTable
+    from superset.datasets.dao import DatasetDAO
+    from superset.models.core import Database
+    from superset.common.query_object import QueryObject
+    from superset.connectors.base.models import BaseDatasource
+    from superset.common.query_context import QueryContext
+    from superset.typing import Metric
+
+
+class QueryContextValidatorImpl(QueryContextValidator):
+    _dataset_dao: DatasetDAO
+    _security_manager: SupersetSecurityManager
+
+    def __init__(
+        self, dataset_dao: DatasetDAO, security_manager: SupersetSecurityManager
+    ):
+        self._dataset_dao = dataset_dao
+        self._security_manager = security_manager
+
+    def validate(self, query_context: QueryContext) -> None:
+        self._validate_actor_can_access(query_context)
+        self._validate_queries_context(query_context)
+
+    def _validate_actor_can_access(self, query_context: QueryContext) -> None:
+        sql_database: Optional[Database] = query_context.get_database()
+        if sql_database is not None:
+            self._validate_when_context_based_on_sql_database(
+                query_context, sql_database
+            )
+        else:
+            self._security_manager.raise_for_access(query_context=query_context)
+
+    def _validate_when_context_based_on_sql_database(
+        self, query_context: QueryContext, sql_database: Database
+    ) -> None:
+        if not self._actor_can_access_all_database_data(sql_database):
+            self._validate_actor_can_access_datasources_context(
+                query_context, sql_database
+            )
+
+    def _actor_can_access_all_database_data(self, sql_database: Database) -> bool:
+        return (
+            self._security_manager.can_access_all_databases()
+            or self._security_manager.can_access_all_datasources()
+            or self._security_manager.can_access_database(sql_database)
+        )
+
+    def _validate_actor_can_access_datasources_context(
+        self, query_context: QueryContext, sql_database: Database
+    ) -> None:
+        datasources = self._get_all_related_datasources(query_context, sql_database)
+        for datasource in datasources:
+            self._security_manager.raise_when_there_is_no_access_to(datasource)
+
+    def _get_all_related_datasources(
+        self, query_context: QueryContext, sql_database: Database
+    ) -> Set[BaseDatasource]:
+
+        datasources: Set[BaseDatasource] = set()
+        datasources.add(query_context.datasource)
+        for query in query_context.queries:
+            self._find_datasources_in_query(query, sql_database)
+        return datasources
+
+    def _find_datasources_in_query(
+        self, query: QueryObject, database: Database
+    ) -> Set[BaseDatasource]:
+
+        datasources: Set[BaseDatasource] = set()
+        datasource = query.get_datasource()
+        if datasource is not None:
+            datasources.add(query.datasource)  # type: ignore
+        if query.metrics:

Review comment:
       ```suggestion
           collect_from_metrics()
   ```
   

##########
File path: superset/charts/commands/query_context_validator.py
##########
@@ -0,0 +1,150 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# pylint: disable=invalid-name, no-self-use, too-few-public-methods
+from __future__ import annotations
+
+from typing import List, Optional, Set, TYPE_CHECKING
+
+from superset.charts.commands.data import QueryContextValidator
+from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
+from superset.exceptions import SupersetSecurityException
+from superset.sql_parse import ParsedQuery, Table
+
+if TYPE_CHECKING:
+    from superset import SupersetSecurityManager
+    from superset.connectors.sqla.models import SqlaTable
+    from superset.datasets.dao import DatasetDAO
+    from superset.models.core import Database
+    from superset.common.query_object import QueryObject
+    from superset.connectors.base.models import BaseDatasource
+    from superset.common.query_context import QueryContext
+    from superset.typing import Metric
+
+
+class QueryContextValidatorImpl(QueryContextValidator):
+    _dataset_dao: DatasetDAO
+    _security_manager: SupersetSecurityManager
+
+    def __init__(
+        self, dataset_dao: DatasetDAO, security_manager: SupersetSecurityManager
+    ):
+        self._dataset_dao = dataset_dao
+        self._security_manager = security_manager
+
+    def validate(self, query_context: QueryContext) -> None:
+        self._validate_actor_can_access(query_context)
+        self._validate_queries_context(query_context)
+
+    def _validate_actor_can_access(self, query_context: QueryContext) -> None:
+        sql_database: Optional[Database] = query_context.get_database()
+        if sql_database is not None:
+            self._validate_when_context_based_on_sql_database(
+                query_context, sql_database
+            )
+        else:
+            self._security_manager.raise_for_access(query_context=query_context)
+
+    def _validate_when_context_based_on_sql_database(
+        self, query_context: QueryContext, sql_database: Database
+    ) -> None:
+        if not self._actor_can_access_all_database_data(sql_database):
+            self._validate_actor_can_access_datasources_context(
+                query_context, sql_database
+            )
+
+    def _actor_can_access_all_database_data(self, sql_database: Database) -> bool:
+        return (
+            self._security_manager.can_access_all_databases()
+            or self._security_manager.can_access_all_datasources()
+            or self._security_manager.can_access_database(sql_database)
+        )
+
+    def _validate_actor_can_access_datasources_context(
+        self, query_context: QueryContext, sql_database: Database
+    ) -> None:
+        datasources = self._get_all_related_datasources(query_context, sql_database)
+        for datasource in datasources:
+            self._security_manager.raise_when_there_is_no_access_to(datasource)
+
+    def _get_all_related_datasources(
+        self, query_context: QueryContext, sql_database: Database
+    ) -> Set[BaseDatasource]:
+
+        datasources: Set[BaseDatasource] = set()
+        datasources.add(query_context.datasource)
+        for query in query_context.queries:
+            self._find_datasources_in_query(query, sql_database)
+        return datasources
+
+    def _find_datasources_in_query(
+        self, query: QueryObject, database: Database
+    ) -> Set[BaseDatasource]:
+
+        datasources: Set[BaseDatasource] = set()
+        datasource = query.get_datasource()
+        if datasource is not None:

Review comment:
       ```suggestion
           Collect_from_query_context()
   ```
   




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


[GitHub] [superset] jayakrishnankk commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
jayakrishnankk commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r749458603



##########
File path: superset/charts/api.py
##########
@@ -617,7 +619,7 @@ def get_data(self, pk: int) -> Response:
         json_body["result_type"] = request.args.get("type", ChartDataResultType.FULL)
 
         try:
-            command = ChartDataCommand()
+            command = self._create_chart_data_command()

Review comment:
       What's left TO DO in this, so that it can get merged ?




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


[GitHub] [superset] hughhhh commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
hughhhh commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r732121382



##########
File path: superset/charts/api.py
##########
@@ -644,6 +646,11 @@ def get_data(self, pk: int) -> Response:
 
         return self.get_data_response(command, form_data=form_data)
 
+    def _create_chart_data_command(self) -> ChartDataCommand:
+        return ChartDataCommand(
+            QueryContextValidatorImpl(DatasetDAO(), security_manager)  # type: ignore

Review comment:
       What is the type error here?




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


[GitHub] [superset] craig-rueda commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
craig-rueda commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r732103325



##########
File path: superset/charts/commands/query_context_validator.py
##########
@@ -0,0 +1,168 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# pylint: disable=invalid-name, no-self-use, too-few-public-methods
+from __future__ import annotations
+
+from typing import List, Optional, Set, TYPE_CHECKING
+
+from superset.charts.commands.data import QueryContextValidator
+from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
+from superset.exceptions import SupersetSecurityException
+from superset.sql_parse import ParsedQuery, Table
+
+if TYPE_CHECKING:
+    from superset import SupersetSecurityManager
+    from superset.connectors.sqla.models import SqlaTable
+    from superset.datasets.dao import DatasetDAO
+    from superset.models.core import Database
+    from superset.common.query_object import QueryObject
+    from superset.connectors.base.models import BaseDatasource
+    from superset.common.query_context import QueryContext
+    from superset.typing import Metric
+
+
+class QueryContextValidatorImpl(QueryContextValidator):
+    _dataset_dao: DatasetDAO
+    _security_manager: SupersetSecurityManager
+
+    def __init__(
+        self, dataset_dao: DatasetDAO, security_manager: SupersetSecurityManager
+    ):
+        self._dataset_dao = dataset_dao
+        self._security_manager = security_manager
+
+    def validate(self, query_context: QueryContext) -> None:
+        self._validate_actor_can_access(query_context)
+        self._validate_queries_context(query_context)
+
+    def _validate_actor_can_access(self, query_context: QueryContext) -> None:
+        sql_database: Optional[Database] = query_context.get_database()
+        if sql_database is not None:
+            self._validate_when_context_based_on_sql_database(
+                query_context, sql_database
+            )
+        else:
+            self._security_manager.raise_for_access(query_context=query_context)
+
+    def _validate_when_context_based_on_sql_database(
+        self, query_context: QueryContext, sql_database: Database
+    ) -> None:
+        if not self._actor_can_access_all_database_data(sql_database):
+            self._validate_actor_can_access_datasources_context(
+                query_context, sql_database
+            )
+
+    def _actor_can_access_all_database_data(self, sql_database: Database) -> bool:
+        return (
+            self._security_manager.can_access_all_databases()
+            or self._security_manager.can_access_all_datasources()
+            or self._security_manager.can_access_database(sql_database)
+        )
+
+    def _validate_actor_can_access_datasources_context(
+        self, query_context: QueryContext, sql_database: Database
+    ) -> None:
+        datasources = self._get_all_related_datasources(query_context, sql_database)
+        for datasource in datasources:
+            self._security_manager.raise_when_there_is_no_access_to(datasource)
+
+    def _get_all_related_datasources(
+        self, query_context: QueryContext, sql_database: Database
+    ) -> Set[BaseDatasource]:
+
+        datasources: Set[BaseDatasource] = set()
+        datasources.add(query_context.datasource)
+        datasources.update(
+            self._collect_datasources_from_queries(query_context.queries, sql_database)
+        )
+        return datasources
+
+    def _collect_datasources_from_queries(
+        self, queries: List[QueryObject], sql_db: Database
+    ) -> Set[BaseDatasource]:
+        datasources: Set[BaseDatasource] = set()
+        for query in queries:
+            datasources.update(self._collect_datasources_from_query(query, sql_db))
+        return datasources
+
+    def _collect_datasources_from_query(
+        self, query: QueryObject, database: Database
+    ) -> Set[BaseDatasource]:
+
+        datasources: Set[BaseDatasource] = set()
+        datasource = query.get_datasource()
+        if datasource is not None:
+            datasources.add(query.datasource)  # type: ignore
+        if query.metrics:
+            datasources.update(
+                self._collect_datasources_from_metrics(query.metrics, database)
+            )
+        return datasources
+
+    def _collect_datasources_from_metrics(
+        self, metrics: List[Metric], database: Database
+    ) -> Set[BaseDatasource]:
+        datasources: Set[BaseDatasource] = set()
+        for metric in metrics:
+            datasources.update(self._find_datasources_in_metric(metric, database))
+        return datasources
+
+    def _find_datasources_in_metric(
+        self, metric: Metric, database: Database
+    ) -> Set[BaseDatasource]:
+        sql_expression = self._get_sql_expression_from_metric(metric)
+        if sql_expression:
+            return self._determine_datasources(sql_expression, database)
+        return set()
+
+    @staticmethod
+    def _get_sql_expression_from_metric(metric: Metric) -> Optional[str]:
+        if isinstance(metric, dict) and "sqlExpression" in metric:
+            return metric["sqlExpression"]
+        return None
+
+    def _determine_datasources(
+        self, sqlExpression: str, database: Database
+    ) -> Set[BaseDatasource]:
+        datasources = set()
+        for table in ParsedQuery(sqlExpression).tables:
+            datasources.update(self._get_datasources_from_table(database, table))
+        return datasources
+
+    def _get_datasources_from_table(
+        self, database: Database, table: Table
+    ) -> List[SqlaTable]:
+        table_datasources = self._dataset_dao.get_by_sql_database_components(
+            database, table.table, table.schema
+        )
+        if len(table_datasources) == 0:
+            raise SupersetSecurityException(
+                SupersetError(

Review comment:
       👍 




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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9033a1d) into [master](https://codecov.io/gh/apache/superset/commit/16e012fe5d791ed6aa5ab755a6386b1581fc5ebd?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (16e012f) will **increase** coverage by `0.06%`.
   > The diff coverage is `73.46%`.
   
   > :exclamation: Current head 9033a1d differs from pull request most recent head c451abf. Consider uploading reports for the commit c451abf to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   + Coverage   76.95%   77.01%   +0.06%     
   ==========================================
     Files        1047     1050       +3     
     Lines       56498    56804     +306     
     Branches     7798     7851      +53     
   ==========================================
   + Hits        43476    43750     +274     
   - Misses      12766    12801      +35     
   + Partials      256      253       -3     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `81.60% <ø> (+0.03%)` | :arrow_up: |
   | mysql | `82.02% <ø> (?)` | |
   | postgres | `82.03% <ø> (+0.03%)` | :arrow_up: |
   | presto | `81.90% <ø> (+0.03%)` | :arrow_up: |
   | python | `82.52% <ø> (+0.10%)` | :arrow_up: |
   | sqlite | `81.71% <ø> (?)` | |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset-frontend/src/SqlLab/actions/sqlLab.js](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9hY3Rpb25zL3NxbExhYi5qcw==) | `58.69% <0.00%> (ø)` | |
   | [...erset-frontend/src/SqlLab/components/App/index.jsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL0FwcC9pbmRleC5qc3g=) | `56.66% <ø> (ø)` | |
   | [...frontend/src/SqlLab/components/ResultSet/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1Jlc3VsdFNldC9pbmRleC50c3g=) | `61.48% <ø> (ø)` | |
   | [...c/SqlLab/components/TemplateParamsEditor/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1RlbXBsYXRlUGFyYW1zRWRpdG9yL2luZGV4LnRzeA==) | `88.88% <ø> (ø)` | |
   | [...uperset-frontend/src/components/Menu/MenuRight.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvTWVudS9NZW51UmlnaHQudHN4) | `92.30% <ø> (ø)` | |
   | [...rontend/src/components/Select/DeprecatedSelect.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L0RlcHJlY2F0ZWRTZWxlY3QudHN4) | `63.63% <ø> (-1.07%)` | :arrow_down: |
   | [...end/src/components/Select/WindowedSelect/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L1dpbmRvd2VkU2VsZWN0L2luZGV4LnRzeA==) | `100.00% <ø> (ø)` | |
   | [...t-frontend/src/dashboard/actions/dashboardState.js](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9hY3Rpb25zL2Rhc2hib2FyZFN0YXRlLmpz) | `28.80% <0.00%> (-0.16%)` | :arrow_down: |
   | [...t-frontend/src/dashboard/components/SliceAdder.jsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlQWRkZXIuanN4) | `76.62% <ø> (ø)` | |
   | [...dashboard/components/SliceHeaderControls/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlSGVhZGVyQ29udHJvbHMvaW5kZXgudHN4) | `75.38% <0.00%> (ø)` | |
   | ... and [127 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [16e012f...c451abf](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] betodealmeida commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
betodealmeida commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r758526754



##########
File path: superset/security/manager.py
##########
@@ -14,8 +14,10 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines, invalid-name

Review comment:
       Putting on each statement means you're aware of the rule, and you consciously decided to break it because practicality beats purity. If you put it at the top of the module the rule could be broken many times without people being aware of it, which reduces the code quality.




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


[GitHub] [superset] hughhhh commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
hughhhh commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r732121608



##########
File path: superset/charts/api.py
##########
@@ -617,7 +619,7 @@ def get_data(self, pk: int) -> Response:
         json_body["result_type"] = request.args.get("type", ChartDataResultType.FULL)
 
         try:
-            command = ChartDataCommand()
+            command = self._create_chart_data_command()

Review comment:
       is there a specific reason why we are wrapping the chart command in a private function?




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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (66ac874) into [master](https://codecov.io/gh/apache/superset/commit/f8a65f8001a5069ab53ce9295fb378abec66dc90?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f8a65f8) will **increase** coverage by `1.33%`.
   > The diff coverage is `86.45%`.
   
   > :exclamation: Current head 66ac874 differs from pull request most recent head c1a9c83. Consider uploading reports for the commit c1a9c83 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   + Coverage   67.10%   68.43%   +1.33%     
   ==========================================
     Files        1609     1590      -19     
     Lines       64897    65082     +185     
     Branches     6866     6963      +97     
   ==========================================
   + Hits        43547    44542     +995     
   + Misses      19484    18650     -834     
   - Partials     1866     1890      +24     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `82.04% <86.45%> (-0.15%)` | :arrow_down: |
   | postgres | `82.05% <86.45%> (-0.20%)` | :arrow_down: |
   | presto | `?` | |
   | python | `82.13% <86.45%> (-0.60%)` | :arrow_down: |
   | sqlite | `81.73% <86.45%> (-0.20%)` | :arrow_down: |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/config.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29uZmlnLnB5) | `91.53% <ø> (-0.11%)` | :arrow_down: |
   | [superset/common/query\_object.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X29iamVjdC5weQ==) | `92.13% <60.00%> (-3.50%)` | :arrow_down: |
   | [superset/datasets/dao.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvZGFvLnB5) | `93.24% <66.66%> (-0.55%)` | :arrow_down: |
   | [superset/common/query\_context.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2NvbnRleHQucHk=) | `86.15% <77.27%> (-6.58%)` | :arrow_down: |
   | [superset/tasks/async\_queries.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdGFza3MvYXN5bmNfcXVlcmllcy5weQ==) | `90.24% <83.33%> (-0.79%)` | :arrow_down: |
   | [...set/charts/data/query\_context\_validator\_factory.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvcXVlcnlfY29udGV4dF92YWxpZGF0b3JfZmFjdG9yeS5weQ==) | `85.71% <85.71%> (ø)` | |
   | [superset/charts/data/commands/get\_data\_command.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvY29tbWFuZHMvZ2V0X2RhdGFfY29tbWFuZC5weQ==) | `96.96% <87.50%> (-3.04%)` | :arrow_down: |
   | [superset/charts/data/query\_context\_validator.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvcXVlcnlfY29udGV4dF92YWxpZGF0b3IucHk=) | `89.41% <89.41%> (ø)` | |
   | [superset/charts/data/api.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvYXBpLnB5) | `88.31% <100.00%> (-0.51%)` | :arrow_down: |
   | [superset/security/manager.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc2VjdXJpdHkvbWFuYWdlci5weQ==) | `91.92% <100.00%> (-0.05%)` | :arrow_down: |
   | ... and [660 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [f8a65f8...c1a9c83](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (66ac874) into [master](https://codecov.io/gh/apache/superset/commit/f8a65f8001a5069ab53ce9295fb378abec66dc90?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f8a65f8) will **increase** coverage by `1.33%`.
   > The diff coverage is `86.45%`.
   
   > :exclamation: Current head 66ac874 differs from pull request most recent head 7e61d28. Consider uploading reports for the commit 7e61d28 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   + Coverage   67.10%   68.43%   +1.33%     
   ==========================================
     Files        1609     1590      -19     
     Lines       64897    65082     +185     
     Branches     6866     6963      +97     
   ==========================================
   + Hits        43547    44542     +995     
   + Misses      19484    18650     -834     
   - Partials     1866     1890      +24     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `82.04% <86.45%> (-0.15%)` | :arrow_down: |
   | postgres | `82.05% <86.45%> (-0.20%)` | :arrow_down: |
   | presto | `?` | |
   | python | `82.13% <86.45%> (-0.60%)` | :arrow_down: |
   | sqlite | `81.73% <86.45%> (-0.20%)` | :arrow_down: |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/config.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29uZmlnLnB5) | `91.53% <ø> (-0.11%)` | :arrow_down: |
   | [superset/common/query\_object.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X29iamVjdC5weQ==) | `92.13% <60.00%> (-3.50%)` | :arrow_down: |
   | [superset/datasets/dao.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvZGFvLnB5) | `93.24% <66.66%> (-0.55%)` | :arrow_down: |
   | [superset/common/query\_context.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2NvbnRleHQucHk=) | `86.15% <77.27%> (-6.58%)` | :arrow_down: |
   | [superset/tasks/async\_queries.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdGFza3MvYXN5bmNfcXVlcmllcy5weQ==) | `90.24% <83.33%> (-0.79%)` | :arrow_down: |
   | [...set/charts/data/query\_context\_validator\_factory.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvcXVlcnlfY29udGV4dF92YWxpZGF0b3JfZmFjdG9yeS5weQ==) | `85.71% <85.71%> (ø)` | |
   | [superset/charts/data/commands/get\_data\_command.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvY29tbWFuZHMvZ2V0X2RhdGFfY29tbWFuZC5weQ==) | `96.96% <87.50%> (-3.04%)` | :arrow_down: |
   | [superset/charts/data/query\_context\_validator.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvcXVlcnlfY29udGV4dF92YWxpZGF0b3IucHk=) | `89.41% <89.41%> (ø)` | |
   | [superset/charts/data/api.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvYXBpLnB5) | `88.31% <100.00%> (-0.51%)` | :arrow_down: |
   | [superset/security/manager.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc2VjdXJpdHkvbWFuYWdlci5weQ==) | `91.92% <100.00%> (-0.05%)` | :arrow_down: |
   | ... and [660 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [f8a65f8...7e61d28](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] ofekisr commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
ofekisr commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r758492110



##########
File path: superset/security/manager.py
##########
@@ -974,14 +976,14 @@ def set_perm(  # pylint: disable=unused-argument
                 )
 
     def raise_for_access(
-        # pylint: disable=too-many-arguments,too-many-locals
+        # pylint: disable=too-many-arguments
         self,
-        database: Optional["Database"] = None,
-        datasource: Optional["BaseDatasource"] = None,
-        query: Optional["Query"] = None,
-        query_context: Optional["QueryContext"] = None,
-        table: Optional["Table"] = None,
-        viz: Optional["BaseViz"] = None,
+        database: Optional[Database] = None,
+        datasource: Optional[BaseDatasource] = None,
+        query: Optional[Query] = None,
+        query_context: Optional[QueryContext] = None,
+        table: Optional[Table] = None,
+        viz: Optional[BaseViz] = None,

Review comment:
       a string representation is worst than the real type




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


[GitHub] [superset] john-bodley commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
john-bodley commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r758787696



##########
File path: superset/security/manager.py
##########
@@ -14,8 +14,10 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines, invalid-name

Review comment:
       +1. The desired pattern is mentioned [here](https://github.com/apache/superset/blob/master/CONTRIBUTING.md#python).




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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9033a1d) into [master](https://codecov.io/gh/apache/superset/commit/16e012fe5d791ed6aa5ab755a6386b1581fc5ebd?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (16e012f) will **increase** coverage by `0.06%`.
   > The diff coverage is `73.46%`.
   
   > :exclamation: Current head 9033a1d differs from pull request most recent head 446bca8. Consider uploading reports for the commit 446bca8 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   + Coverage   76.95%   77.01%   +0.06%     
   ==========================================
     Files        1047     1050       +3     
     Lines       56498    56804     +306     
     Branches     7798     7851      +53     
   ==========================================
   + Hits        43476    43750     +274     
   - Misses      12766    12801      +35     
   + Partials      256      253       -3     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `81.60% <ø> (+0.03%)` | :arrow_up: |
   | mysql | `82.02% <ø> (?)` | |
   | postgres | `82.03% <ø> (+0.03%)` | :arrow_up: |
   | presto | `81.90% <ø> (+0.03%)` | :arrow_up: |
   | python | `82.52% <ø> (+0.10%)` | :arrow_up: |
   | sqlite | `81.71% <ø> (?)` | |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset-frontend/src/SqlLab/actions/sqlLab.js](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9hY3Rpb25zL3NxbExhYi5qcw==) | `58.69% <0.00%> (ø)` | |
   | [...erset-frontend/src/SqlLab/components/App/index.jsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL0FwcC9pbmRleC5qc3g=) | `56.66% <ø> (ø)` | |
   | [...frontend/src/SqlLab/components/ResultSet/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1Jlc3VsdFNldC9pbmRleC50c3g=) | `61.48% <ø> (ø)` | |
   | [...c/SqlLab/components/TemplateParamsEditor/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1RlbXBsYXRlUGFyYW1zRWRpdG9yL2luZGV4LnRzeA==) | `88.88% <ø> (ø)` | |
   | [...uperset-frontend/src/components/Menu/MenuRight.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvTWVudS9NZW51UmlnaHQudHN4) | `92.30% <ø> (ø)` | |
   | [...rontend/src/components/Select/DeprecatedSelect.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L0RlcHJlY2F0ZWRTZWxlY3QudHN4) | `63.63% <ø> (-1.07%)` | :arrow_down: |
   | [...end/src/components/Select/WindowedSelect/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L1dpbmRvd2VkU2VsZWN0L2luZGV4LnRzeA==) | `100.00% <ø> (ø)` | |
   | [...t-frontend/src/dashboard/actions/dashboardState.js](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9hY3Rpb25zL2Rhc2hib2FyZFN0YXRlLmpz) | `28.80% <0.00%> (-0.16%)` | :arrow_down: |
   | [...t-frontend/src/dashboard/components/SliceAdder.jsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlQWRkZXIuanN4) | `76.62% <ø> (ø)` | |
   | [...dashboard/components/SliceHeaderControls/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlSGVhZGVyQ29udHJvbHMvaW5kZXgudHN4) | `75.38% <0.00%> (ø)` | |
   | ... and [127 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [16e012f...446bca8](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] ofekisr commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
ofekisr commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r757650455



##########
File path: superset/charts/api.py
##########
@@ -617,7 +619,7 @@ def get_data(self, pk: int) -> Response:
         json_body["result_type"] = request.args.get("type", ChartDataResultType.FULL)
 
         try:
-            command = ChartDataCommand()
+            command = self._create_chart_data_command()

Review comment:
       @jayakrishnankk review and merge




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


[GitHub] [superset] craig-rueda commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
craig-rueda commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r732101000



##########
File path: superset/charts/commands/query_context_validator.py
##########
@@ -0,0 +1,168 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# pylint: disable=invalid-name, no-self-use, too-few-public-methods
+from __future__ import annotations
+
+from typing import List, Optional, Set, TYPE_CHECKING
+
+from superset.charts.commands.data import QueryContextValidator
+from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
+from superset.exceptions import SupersetSecurityException
+from superset.sql_parse import ParsedQuery, Table
+
+if TYPE_CHECKING:
+    from superset import SupersetSecurityManager
+    from superset.connectors.sqla.models import SqlaTable
+    from superset.datasets.dao import DatasetDAO
+    from superset.models.core import Database
+    from superset.common.query_object import QueryObject
+    from superset.connectors.base.models import BaseDatasource
+    from superset.common.query_context import QueryContext
+    from superset.typing import Metric
+
+
+class QueryContextValidatorImpl(QueryContextValidator):
+    _dataset_dao: DatasetDAO
+    _security_manager: SupersetSecurityManager
+
+    def __init__(
+        self, dataset_dao: DatasetDAO, security_manager: SupersetSecurityManager
+    ):
+        self._dataset_dao = dataset_dao
+        self._security_manager = security_manager
+
+    def validate(self, query_context: QueryContext) -> None:
+        self._validate_actor_can_access(query_context)
+        self._validate_queries_context(query_context)
+
+    def _validate_actor_can_access(self, query_context: QueryContext) -> None:
+        sql_database: Optional[Database] = query_context.get_database()
+        if sql_database is not None:
+            self._validate_when_context_based_on_sql_database(
+                query_context, sql_database
+            )
+        else:
+            self._security_manager.raise_for_access(query_context=query_context)
+
+    def _validate_when_context_based_on_sql_database(

Review comment:
       Is there a reason for all the method delegation here? Maybe just compact this into a single method?




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


[GitHub] [superset] ofekisr commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
ofekisr commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r732141563



##########
File path: superset/charts/api.py
##########
@@ -617,7 +619,7 @@ def get_data(self, pk: int) -> Response:
         json_body["result_type"] = request.args.get("type", ChartDataResultType.FULL)
 
         try:
-            command = ChartDataCommand()
+            command = self._create_chart_data_command()

Review comment:
       > is there a specific reason why we are wrapping the chart command in a private function?
   
   1. Preventing code reusing 
   2. The way the command is created is not the function task, SRP
   3. The one who follows the code, don't care how the command is created he just want to get the command and run it, if it still interested it steps into the private method




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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (fb7bfa2) into [master](https://codecov.io/gh/apache/superset/commit/16e012fe5d791ed6aa5ab755a6386b1581fc5ebd?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (16e012f) will **decrease** coverage by `0.16%`.
   > The diff coverage is `85.91%`.
   
   > :exclamation: Current head fb7bfa2 differs from pull request most recent head 2f6b0ce. Consider uploading reports for the commit 2f6b0ce to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   - Coverage   76.95%   76.78%   -0.17%     
   ==========================================
     Files        1047     1048       +1     
     Lines       56498    56620     +122     
     Branches     7798     7798              
   ==========================================
   + Hits        43476    43477       +1     
   - Misses      12766    12887     +121     
     Partials      256      256              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `81.98% <85.91%> (?)` | |
   | postgres | `81.99% <85.91%> (-0.01%)` | :arrow_down: |
   | presto | `?` | |
   | python | `82.08% <85.91%> (-0.34%)` | :arrow_down: |
   | sqlite | `81.67% <85.91%> (?)` | |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/common/query\_object.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X29iamVjdC5weQ==) | `92.13% <60.00%> (-0.93%)` | :arrow_down: |
   | [superset/datasets/dao.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvZGFvLnB5) | `93.24% <66.66%> (-0.55%)` | :arrow_down: |
   | [superset/common/query\_context.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2NvbnRleHQucHk=) | `84.61% <72.72%> (-7.84%)` | :arrow_down: |
   | [superset/tasks/async\_queries.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdGFza3MvYXN5bmNfcXVlcmllcy5weQ==) | `90.36% <85.71%> (-0.67%)` | :arrow_down: |
   | [superset/charts/data/commands/get\_data\_command.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvY29tbWFuZHMvZ2V0X2RhdGFfY29tbWFuZC5weQ==) | `96.96% <87.50%> (-3.04%)` | :arrow_down: |
   | [superset/charts/data/query\_context\_validator.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvcXVlcnlfY29udGV4dF92YWxpZGF0b3IucHk=) | `89.28% <89.28%> (ø)` | |
   | [superset/charts/data/api.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvYXBpLnB5) | `88.38% <100.00%> (+0.30%)` | :arrow_up: |
   | [superset/security/manager.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc2VjdXJpdHkvbWFuYWdlci5weQ==) | `91.90% <100.00%> (+0.06%)` | :arrow_up: |
   | [superset/db\_engines/hive.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lcy9oaXZlLnB5) | `0.00% <0.00%> (-85.19%)` | :arrow_down: |
   | [superset/db\_engine\_specs/hive.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2hpdmUucHk=) | `69.49% <0.00%> (-16.99%)` | :arrow_down: |
   | ... and [14 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [16e012f...2f6b0ce](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (83dca79) into [master](https://codecov.io/gh/apache/superset/commit/16e012fe5d791ed6aa5ab755a6386b1581fc5ebd?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (16e012f) will **decrease** coverage by `0.16%`.
   > The diff coverage is `85.91%`.
   
   > :exclamation: Current head 83dca79 differs from pull request most recent head 2f6b0ce. Consider uploading reports for the commit 2f6b0ce to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   - Coverage   76.95%   76.78%   -0.17%     
   ==========================================
     Files        1047     1048       +1     
     Lines       56498    56620     +122     
     Branches     7798     7798              
   ==========================================
   + Hits        43476    43477       +1     
   - Misses      12766    12887     +121     
     Partials      256      256              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `81.98% <85.91%> (?)` | |
   | postgres | `81.99% <85.91%> (-0.01%)` | :arrow_down: |
   | presto | `?` | |
   | python | `82.08% <85.91%> (-0.34%)` | :arrow_down: |
   | sqlite | `81.67% <85.91%> (?)` | |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/common/query\_object.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X29iamVjdC5weQ==) | `92.13% <60.00%> (-0.93%)` | :arrow_down: |
   | [superset/datasets/dao.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvZGFvLnB5) | `93.24% <66.66%> (-0.55%)` | :arrow_down: |
   | [superset/common/query\_context.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2NvbnRleHQucHk=) | `84.61% <72.72%> (-7.84%)` | :arrow_down: |
   | [superset/tasks/async\_queries.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdGFza3MvYXN5bmNfcXVlcmllcy5weQ==) | `90.36% <85.71%> (-0.67%)` | :arrow_down: |
   | [superset/charts/data/commands/get\_data\_command.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvY29tbWFuZHMvZ2V0X2RhdGFfY29tbWFuZC5weQ==) | `96.96% <87.50%> (-3.04%)` | :arrow_down: |
   | [superset/charts/data/query\_context\_validator.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvcXVlcnlfY29udGV4dF92YWxpZGF0b3IucHk=) | `89.28% <89.28%> (ø)` | |
   | [superset/charts/data/api.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvYXBpLnB5) | `88.38% <100.00%> (+0.30%)` | :arrow_up: |
   | [superset/security/manager.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc2VjdXJpdHkvbWFuYWdlci5weQ==) | `91.90% <100.00%> (+0.06%)` | :arrow_up: |
   | [superset/db\_engines/hive.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lcy9oaXZlLnB5) | `0.00% <0.00%> (-85.19%)` | :arrow_down: |
   | [superset/db\_engine\_specs/hive.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2hpdmUucHk=) | `69.49% <0.00%> (-16.99%)` | :arrow_down: |
   | ... and [14 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [16e012f...2f6b0ce](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] ofekisr commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
ofekisr commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r759080431



##########
File path: superset/charts/data/commands/get_data_command.py
##########
@@ -14,6 +14,8 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+from __future__ import annotations
+

Review comment:
       https://docs.python.org/3/library/__future__.html
   
   ![image](https://user-images.githubusercontent.com/35701650/144020171-d5ecaa5e-c8df-4aac-8499-8455b071f98f.png)
   
   you should add it until all supported versions are at least 3.11 
   
   I use that future for the type hints 




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


[GitHub] [superset] ofekisr commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
ofekisr commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r758490311



##########
File path: superset/security/manager.py
##########
@@ -1047,17 +1048,23 @@ def raise_for_access(
 
             assert datasource
 
-            if not (
-                self.can_access_schema(datasource)
-                or self.can_access("datasource_access", datasource.perm or "")
-                or (
-                    feature_flag_manager.is_feature_enabled("DASHBOARD_RBAC")
-                    and self.can_access_based_on_dashboard(datasource)
-                )
-            ):
-                raise SupersetSecurityException(
-                    self.get_datasource_access_error_object(datasource)
-                )
+            self.raise_when_there_is_no_access_to(datasource)
+
+    def raise_when_there_is_no_access_to(self, datasource: BaseDatasource) -> None:

Review comment:
       "raise_for_dashboard_acess" is even more bad name. what is mean "dashboard_acess" ?
   
   a better name conventions are on of those: validate_<object_type>_can_be_accessed
   or 
   actor_can_access_<object_type>
   




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


[GitHub] [superset] etr2460 commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
etr2460 commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r758730334



##########
File path: superset/security/manager.py
##########
@@ -1047,17 +1048,23 @@ def raise_for_access(
 
             assert datasource
 
-            if not (
-                self.can_access_schema(datasource)
-                or self.can_access("datasource_access", datasource.perm or "")
-                or (
-                    feature_flag_manager.is_feature_enabled("DASHBOARD_RBAC")
-                    and self.can_access_based_on_dashboard(datasource)
-                )
-            ):
-                raise SupersetSecurityException(
-                    self.get_datasource_access_error_object(datasource)
-                )
+            self.raise_when_there_is_no_access_to(datasource)
+
+    def raise_when_there_is_no_access_to(self, datasource: BaseDatasource) -> None:

Review comment:
       noting that this pattern was originally used (i think) because it follows the similar one used by the python requests package, `raise_for_status`: https://docs.python-requests.org/en/latest/api/#requests.Response.raise_for_status
   
   @john-bodley might know a bit more about why we picked this naming




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


[GitHub] [superset] villebro commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
villebro commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r758153548



##########
File path: tests/common/query_context_generator.py
##########
@@ -248,12 +302,77 @@ def generate(
         return {
             "datasource": {"id": table.id, "type": table.type},
             "queries": [
-                get_query_object(
+                self.generate_query_object(
                     query_name, add_postprocessing_operations, add_time_offsets,
                 )
             ],
             "result_type": ChartDataResultType.FULL,
         }
 
+    @staticmethod
+    def generate_query_object(
+        query_name: str,
+        add_postprocessing_operations: bool = False,
+        add_time_offsets: bool = False,
+        **kwargs: Any,
+    ) -> Dict[Any, Any]:
+        if query_name in QUERY_OBJECTS:
+            obj = QUERY_OBJECTS[query_name]
+
+            # apply overrides
+            if ":" in query_name:
+                parent_query_name = query_name.split(":")[0]
+                obj = {
+                    **QUERY_OBJECTS[parent_query_name],
+                    **obj,
+                }
+        else:
+            obj = DEFAULT_VALUES
+
+        query_object = copy.deepcopy(obj)
+        if add_postprocessing_operations:
+            query_object["post_processing"] = _get_postprocessing_operation(query_name)
+        if add_time_offsets:
+            query_object["time_offsets"] = ["1 year ago"]
+
+        if kwargs:
+            dict_merge(query_object, kwargs)
+
+        return query_object
+
+    @staticmethod
+    def generate_sql_expression_metric(
+        column_name="name", table_name="superset.ab_permission", **kwargs: Any
+    ) -> Dict[str, Any]:
+        return dict_merge(
+            {
+                "aggregate": "COUNT",
+                "column": {
+                    "certification_details": None,
+                    "certified_by": None,
+                    "column_name": column_name,
+                    "description": None,
+                    "expression": None,
+                    "filterable": True,
+                    "groupby": True,
+                    "id": 572,
+                    "is_certified": False,
+                    "is_dttm": False,
+                    "python_date_format": None,
+                    "type": "TEXT",
+                    "type_generic": 1,
+                    "verbose_name": None,
+                    "warning_markdown": None,
+                },
+                "expressionType": "SQL",
+                "hasCustomLabel": False,
+                "isNew": False,
+                "label": "COUNT({})".format(column_name),

Review comment:
       nit:
   ```suggestion
                   "label": f"COUNT({column_name})",
   ```

##########
File path: superset/security/manager.py
##########
@@ -14,8 +14,10 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines, invalid-name

Review comment:
       I don't think we should be adding global disables like this here

##########
File path: superset/charts/data/commands/get_data_command.py
##########
@@ -14,6 +14,8 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+from __future__ import annotations
+

Review comment:
       nit: I don't believe we need these, as we're no longer actively supporting 3.7 (will be fully deprecated shortly)

##########
File path: superset/security/manager.py
##########
@@ -974,14 +976,14 @@ def set_perm(  # pylint: disable=unused-argument
                 )
 
     def raise_for_access(
-        # pylint: disable=too-many-arguments,too-many-locals
+        # pylint: disable=too-many-arguments
         self,
-        database: Optional["Database"] = None,
-        datasource: Optional["BaseDatasource"] = None,
-        query: Optional["Query"] = None,
-        query_context: Optional["QueryContext"] = None,
-        table: Optional["Table"] = None,
-        viz: Optional["BaseViz"] = None,
+        database: Optional[Database] = None,
+        datasource: Optional[BaseDatasource] = None,
+        query: Optional[Query] = None,
+        query_context: Optional[QueryContext] = None,
+        table: Optional[Table] = None,
+        viz: Optional[BaseViz] = None,

Review comment:
       Is this nowadays the correct way of referring to imports from `TYPE_CHECKING`?

##########
File path: superset/security/manager.py
##########
@@ -1047,17 +1048,23 @@ def raise_for_access(
 
             assert datasource
 
-            if not (
-                self.can_access_schema(datasource)
-                or self.can_access("datasource_access", datasource.perm or "")
-                or (
-                    feature_flag_manager.is_feature_enabled("DASHBOARD_RBAC")
-                    and self.can_access_based_on_dashboard(datasource)
-                )
-            ):
-                raise SupersetSecurityException(
-                    self.get_datasource_access_error_object(datasource)
-                )
+            self.raise_when_there_is_no_access_to(datasource)
+
+    def raise_when_there_is_no_access_to(self, datasource: BaseDatasource) -> None:

Review comment:
       This name should IMO follow the existing naming conventions. In this case `raise_for_datasource_access` would be more appropriate and more aligned with the pre-existing `raise_for_dashboard_access`.

##########
File path: tests/common/query_context_generator.py
##########
@@ -248,12 +302,77 @@ def generate(
         return {
             "datasource": {"id": table.id, "type": table.type},
             "queries": [
-                get_query_object(
+                self.generate_query_object(
                     query_name, add_postprocessing_operations, add_time_offsets,
                 )
             ],
             "result_type": ChartDataResultType.FULL,
         }
 
+    @staticmethod
+    def generate_query_object(
+        query_name: str,
+        add_postprocessing_operations: bool = False,
+        add_time_offsets: bool = False,
+        **kwargs: Any,
+    ) -> Dict[Any, Any]:
+        if query_name in QUERY_OBJECTS:
+            obj = QUERY_OBJECTS[query_name]
+
+            # apply overrides
+            if ":" in query_name:
+                parent_query_name = query_name.split(":")[0]
+                obj = {
+                    **QUERY_OBJECTS[parent_query_name],
+                    **obj,
+                }
+        else:
+            obj = DEFAULT_VALUES
+
+        query_object = copy.deepcopy(obj)
+        if add_postprocessing_operations:
+            query_object["post_processing"] = _get_postprocessing_operation(query_name)
+        if add_time_offsets:
+            query_object["time_offsets"] = ["1 year ago"]
+
+        if kwargs:
+            dict_merge(query_object, kwargs)
+
+        return query_object
+
+    @staticmethod
+    def generate_sql_expression_metric(
+        column_name="name", table_name="superset.ab_permission", **kwargs: Any
+    ) -> Dict[str, Any]:
+        return dict_merge(
+            {
+                "aggregate": "COUNT",
+                "column": {
+                    "certification_details": None,
+                    "certified_by": None,
+                    "column_name": column_name,
+                    "description": None,
+                    "expression": None,
+                    "filterable": True,
+                    "groupby": True,
+                    "id": 572,
+                    "is_certified": False,
+                    "is_dttm": False,
+                    "python_date_format": None,
+                    "type": "TEXT",
+                    "type_generic": 1,
+                    "verbose_name": None,
+                    "warning_markdown": None,
+                },
+                "expressionType": "SQL",
+                "hasCustomLabel": False,
+                "isNew": False,
+                "label": "COUNT({})".format(column_name),
+                "optionName": "metric_bvvzfjgdg7_eawlsdp84tq",
+                "sqlExpression": "(SELECT count(name) FROM {})".format(table_name),

Review comment:
       nit: 
   ```suggestion
                   "sqlExpression": f"(SELECT count(name) FROM {table_name})",
   ```

##########
File path: superset/charts/data/query_context_validator.py
##########
@@ -0,0 +1,168 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# pylint: disable=invalid-name, no-self-use, too-few-public-methods
+from __future__ import annotations
+
+from typing import List, Optional, Set, TYPE_CHECKING
+
+from superset.charts.data.commands.get_data_command import QueryContextValidator
+from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
+from superset.exceptions import SupersetSecurityException
+from superset.sql_parse import ParsedQuery, Table
+
+if TYPE_CHECKING:
+    from superset import SupersetSecurityManager
+    from superset.common.query_context import QueryContext
+    from superset.common.query_object import QueryObject
+    from superset.connectors.base.models import BaseDatasource
+    from superset.connectors.sqla.models import SqlaTable
+    from superset.datasets.dao import DatasetDAO
+    from superset.models.core import Database
+    from superset.typing import Metric
+
+
+class QueryContextValidatorImpl(QueryContextValidator):
+    _dataset_dao: DatasetDAO
+    _security_manager: SupersetSecurityManager
+
+    def __init__(
+        self, dataset_dao: DatasetDAO, security_manager: SupersetSecurityManager
+    ):
+        self._dataset_dao = dataset_dao
+        self._security_manager = security_manager
+
+    def validate(self, query_context: QueryContext) -> None:
+        self._validate_actor_can_access(query_context)
+        self._validate_queries_context(query_context)
+
+    def _validate_actor_can_access(self, query_context: QueryContext) -> None:
+        sql_database: Optional[Database] = query_context.get_database()
+        if sql_database is not None:
+            self._validate_when_context_based_on_sql_database(
+                query_context, sql_database
+            )
+        else:
+            self._security_manager.raise_for_access(query_context=query_context)
+
+    def _validate_when_context_based_on_sql_database(

Review comment:
       This has come up in previous review comments from me. While I agree that it's good practice to break out logical chunks to improve readability and enforce separation of concerns, there is a point when abstraction can actually decrease readability. Each nested call causes additional cognitive overhead for the reviewer, and dilutes the relevance of other more important functions/methods. As a rule of thumb, if a private method is 1) only used once 2) consists of less than 5 lines of code 3) further branches out into another private method which also satisfies 1) and 2), I would consider just inlining the code and adding a comment describing what is happening (if needed).




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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (66ac874) into [master](https://codecov.io/gh/apache/superset/commit/16e012fe5d791ed6aa5ab755a6386b1581fc5ebd?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (16e012f) will **decrease** coverage by `8.51%`.
   > The diff coverage is `87.79%`.
   
   > :exclamation: Current head 66ac874 differs from pull request most recent head 5f45fc1. Consider uploading reports for the commit 5f45fc1 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   - Coverage   76.95%   68.43%   -8.52%     
   ==========================================
     Files        1047     1590     +543     
     Lines       56498    65082    +8584     
     Branches     7798     6963     -835     
   ==========================================
   + Hits        43476    44542    +1066     
   - Misses      12766    18650    +5884     
   - Partials      256     1890    +1634     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `82.04% <ø> (?)` | |
   | postgres | `82.05% <ø> (+0.05%)` | :arrow_up: |
   | presto | `?` | |
   | python | `82.13% <ø> (-0.29%)` | :arrow_down: |
   | sqlite | `81.73% <ø> (?)` | |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [.../superset-ui-core/src/query/types/QueryFormData.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvUXVlcnlGb3JtRGF0YS50cw==) | `87.50% <ø> (ø)` | |
   | [.../superset-ui-core/src/query/types/QueryResponse.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvUXVlcnlSZXNwb25zZS50cw==) | `100.00% <ø> (ø)` | |
   | [.../packages/superset-ui-core/src/query/types/Time.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvVGltZS50cw==) | `100.00% <ø> (ø)` | |
   | [...packages/superset-ui-core/src/query/types/index.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvaW5kZXgudHM=) | `100.00% <ø> (ø)` | |
   | [...tend/packages/superset-ui-core/src/style/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvc3R5bGUvaW5kZXgudHN4) | `100.00% <ø> (ø)` | |
   | [...es/superset-ui-core/src/time-format/TimeFormats.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHMudHM=) | `100.00% <ø> (ø)` | |
   | [...-core/src/time-format/TimeFormatsForGranularity.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHNGb3JHcmFudWxhcml0eS50cw==) | `100.00% <ø> (ø)` | |
   | [.../superset-ui-core/src/time-format/TimeFormatter.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHRlci50cw==) | `95.23% <ø> (ø)` | |
   | [...t-ui-core/src/time-format/TimeFormatterRegistry.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHRlclJlZ2lzdHJ5LnRz) | `94.11% <ø> (ø)` | |
   | [.../src/time-format/TimeFormatterRegistrySingleton.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHRlclJlZ2lzdHJ5U2luZ2xldG9uLnRz) | `85.71% <ø> (ø)` | |
   | ... and [1135 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [16e012f...5f45fc1](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] ofekisr commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
ofekisr commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r768520254



##########
File path: tests/common/query_context_generator.py
##########
@@ -199,16 +199,16 @@ def get_query_object(
     query_name: str, add_postprocessing_operations: bool, add_time_offsets: bool,
 ) -> Dict[str, Any]:
     if query_name not in QUERY_OBJECTS:
-        raise Exception(f"QueryObject fixture not defined for datasource: {query_name}")
-    obj = QUERY_OBJECTS[query_name]
-
-    # apply overrides
-    if ":" in query_name:
-        parent_query_name = query_name.split(":")[0]
-        obj = {
-            **QUERY_OBJECTS[parent_query_name],
-            **obj,
-        }
+        obj = QUERY_OBJECTS[query_name]

Review comment:
       this is not the updated code




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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c430381) into [master](https://codecov.io/gh/apache/superset/commit/16e012fe5d791ed6aa5ab755a6386b1581fc5ebd?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (16e012f) will **decrease** coverage by `8.53%`.
   > The diff coverage is `87.79%`.
   
   > :exclamation: Current head c430381 differs from pull request most recent head 44d25d0. Consider uploading reports for the commit 44d25d0 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   - Coverage   76.95%   68.42%   -8.54%     
   ==========================================
     Files        1047     1590     +543     
     Lines       56498    65082    +8584     
     Branches     7798     6963     -835     
   ==========================================
   + Hits        43476    44530    +1054     
   - Misses      12766    18662    +5896     
   - Partials      256     1890    +1634     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `82.04% <ø> (?)` | |
   | postgres | `82.05% <ø> (+0.05%)` | :arrow_up: |
   | presto | `?` | |
   | python | `82.09% <ø> (-0.33%)` | :arrow_down: |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [.../superset-ui-core/src/query/types/QueryFormData.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvUXVlcnlGb3JtRGF0YS50cw==) | `87.50% <ø> (ø)` | |
   | [.../superset-ui-core/src/query/types/QueryResponse.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvUXVlcnlSZXNwb25zZS50cw==) | `100.00% <ø> (ø)` | |
   | [.../packages/superset-ui-core/src/query/types/Time.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvVGltZS50cw==) | `100.00% <ø> (ø)` | |
   | [...packages/superset-ui-core/src/query/types/index.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvaW5kZXgudHM=) | `100.00% <ø> (ø)` | |
   | [...tend/packages/superset-ui-core/src/style/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvc3R5bGUvaW5kZXgudHN4) | `100.00% <ø> (ø)` | |
   | [...es/superset-ui-core/src/time-format/TimeFormats.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHMudHM=) | `100.00% <ø> (ø)` | |
   | [...-core/src/time-format/TimeFormatsForGranularity.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHNGb3JHcmFudWxhcml0eS50cw==) | `100.00% <ø> (ø)` | |
   | [.../superset-ui-core/src/time-format/TimeFormatter.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHRlci50cw==) | `95.23% <ø> (ø)` | |
   | [...t-ui-core/src/time-format/TimeFormatterRegistry.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHRlclJlZ2lzdHJ5LnRz) | `94.11% <ø> (ø)` | |
   | [.../src/time-format/TimeFormatterRegistrySingleton.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHRlclJlZ2lzdHJ5U2luZ2xldG9uLnRz) | `85.71% <ø> (ø)` | |
   | ... and [1132 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [16e012f...44d25d0](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9033a1d) into [master](https://codecov.io/gh/apache/superset/commit/16e012fe5d791ed6aa5ab755a6386b1581fc5ebd?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (16e012f) will **decrease** coverage by `0.14%`.
   > The diff coverage is `73.46%`.
   
   > :exclamation: Current head 9033a1d differs from pull request most recent head c451abf. Consider uploading reports for the commit c451abf to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   - Coverage   76.95%   76.80%   -0.15%     
   ==========================================
     Files        1047     1050       +3     
     Lines       56498    56804     +306     
     Branches     7798     7851      +53     
   ==========================================
   + Hits        43476    43631     +155     
   - Misses      12766    12920     +154     
   + Partials      256      253       -3     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `82.02% <ø> (?)` | |
   | postgres | `82.03% <ø> (+0.03%)` | :arrow_up: |
   | presto | `?` | |
   | python | `82.12% <ø> (-0.31%)` | :arrow_down: |
   | sqlite | `81.71% <ø> (?)` | |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset-frontend/src/SqlLab/actions/sqlLab.js](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9hY3Rpb25zL3NxbExhYi5qcw==) | `58.69% <0.00%> (ø)` | |
   | [...erset-frontend/src/SqlLab/components/App/index.jsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL0FwcC9pbmRleC5qc3g=) | `56.66% <ø> (ø)` | |
   | [...frontend/src/SqlLab/components/ResultSet/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1Jlc3VsdFNldC9pbmRleC50c3g=) | `61.48% <ø> (ø)` | |
   | [...c/SqlLab/components/TemplateParamsEditor/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1RlbXBsYXRlUGFyYW1zRWRpdG9yL2luZGV4LnRzeA==) | `88.88% <ø> (ø)` | |
   | [...uperset-frontend/src/components/Menu/MenuRight.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvTWVudS9NZW51UmlnaHQudHN4) | `92.30% <ø> (ø)` | |
   | [...rontend/src/components/Select/DeprecatedSelect.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L0RlcHJlY2F0ZWRTZWxlY3QudHN4) | `63.63% <ø> (-1.07%)` | :arrow_down: |
   | [...end/src/components/Select/WindowedSelect/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L1dpbmRvd2VkU2VsZWN0L2luZGV4LnRzeA==) | `100.00% <ø> (ø)` | |
   | [...t-frontend/src/dashboard/actions/dashboardState.js](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9hY3Rpb25zL2Rhc2hib2FyZFN0YXRlLmpz) | `28.80% <0.00%> (-0.16%)` | :arrow_down: |
   | [...t-frontend/src/dashboard/components/SliceAdder.jsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlQWRkZXIuanN4) | `76.62% <ø> (ø)` | |
   | [...dashboard/components/SliceHeaderControls/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlSGVhZGVyQ29udHJvbHMvaW5kZXgudHN4) | `75.38% <0.00%> (ø)` | |
   | ... and [130 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [16e012f...c451abf](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] ofekisr commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
ofekisr commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r759100390



##########
File path: superset/charts/data/commands/get_data_command.py
##########
@@ -14,6 +14,8 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+from __future__ import annotations
+

Review comment:
       @villebro 
   regarding the FF, I don't agree with it since the change is fixing a bug a not adding new functionality.
   if someone will encounter a surprising issue with it, it means "hey it got something, we have a security breach" so the app administrator should think about how to solve it, giving extra permission or removing the metric.
   
   this is my IMO, but for now I'll add that FF 
   
   
   




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


[GitHub] [superset] craig-rueda commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
craig-rueda commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r758595549



##########
File path: superset/charts/data/commands/get_data_command.py
##########
@@ -14,6 +14,8 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+from __future__ import annotations
+

Review comment:
       Yep, let's remove this if we can.




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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9033a1d) into [master](https://codecov.io/gh/apache/superset/commit/16e012fe5d791ed6aa5ab755a6386b1581fc5ebd?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (16e012f) will **increase** coverage by `0.06%`.
   > The diff coverage is `73.46%`.
   
   > :exclamation: Current head 9033a1d differs from pull request most recent head 360a04b. Consider uploading reports for the commit 360a04b to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   + Coverage   76.95%   77.01%   +0.06%     
   ==========================================
     Files        1047     1050       +3     
     Lines       56498    56804     +306     
     Branches     7798     7851      +53     
   ==========================================
   + Hits        43476    43750     +274     
   - Misses      12766    12801      +35     
   + Partials      256      253       -3     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `81.60% <ø> (+0.03%)` | :arrow_up: |
   | mysql | `82.02% <ø> (?)` | |
   | postgres | `82.03% <ø> (+0.03%)` | :arrow_up: |
   | presto | `81.90% <ø> (+0.03%)` | :arrow_up: |
   | python | `82.52% <ø> (+0.10%)` | :arrow_up: |
   | sqlite | `81.71% <ø> (?)` | |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset-frontend/src/SqlLab/actions/sqlLab.js](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9hY3Rpb25zL3NxbExhYi5qcw==) | `58.69% <0.00%> (ø)` | |
   | [...erset-frontend/src/SqlLab/components/App/index.jsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL0FwcC9pbmRleC5qc3g=) | `56.66% <ø> (ø)` | |
   | [...frontend/src/SqlLab/components/ResultSet/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1Jlc3VsdFNldC9pbmRleC50c3g=) | `61.48% <ø> (ø)` | |
   | [...c/SqlLab/components/TemplateParamsEditor/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1RlbXBsYXRlUGFyYW1zRWRpdG9yL2luZGV4LnRzeA==) | `88.88% <ø> (ø)` | |
   | [...uperset-frontend/src/components/Menu/MenuRight.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvTWVudS9NZW51UmlnaHQudHN4) | `92.30% <ø> (ø)` | |
   | [...rontend/src/components/Select/DeprecatedSelect.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L0RlcHJlY2F0ZWRTZWxlY3QudHN4) | `63.63% <ø> (-1.07%)` | :arrow_down: |
   | [...end/src/components/Select/WindowedSelect/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L1dpbmRvd2VkU2VsZWN0L2luZGV4LnRzeA==) | `100.00% <ø> (ø)` | |
   | [...t-frontend/src/dashboard/actions/dashboardState.js](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9hY3Rpb25zL2Rhc2hib2FyZFN0YXRlLmpz) | `28.80% <0.00%> (-0.16%)` | :arrow_down: |
   | [...t-frontend/src/dashboard/components/SliceAdder.jsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlQWRkZXIuanN4) | `76.62% <ø> (ø)` | |
   | [...dashboard/components/SliceHeaderControls/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlSGVhZGVyQ29udHJvbHMvaW5kZXgudHN4) | `75.38% <0.00%> (ø)` | |
   | ... and [127 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [16e012f...360a04b](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] amitmiran137 commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
amitmiran137 commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r724423651



##########
File path: superset/charts/commands/query_context_validator.py
##########
@@ -0,0 +1,150 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# pylint: disable=invalid-name, no-self-use, too-few-public-methods
+from __future__ import annotations
+
+from typing import List, Optional, Set, TYPE_CHECKING
+
+from superset.charts.commands.data import QueryContextValidator
+from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
+from superset.exceptions import SupersetSecurityException
+from superset.sql_parse import ParsedQuery, Table
+
+if TYPE_CHECKING:
+    from superset import SupersetSecurityManager
+    from superset.connectors.sqla.models import SqlaTable
+    from superset.datasets.dao import DatasetDAO
+    from superset.models.core import Database
+    from superset.common.query_object import QueryObject
+    from superset.connectors.base.models import BaseDatasource
+    from superset.common.query_context import QueryContext
+    from superset.typing import Metric
+
+
+class QueryContextValidatorImpl(QueryContextValidator):
+    _dataset_dao: DatasetDAO
+    _security_manager: SupersetSecurityManager
+
+    def __init__(
+        self, dataset_dao: DatasetDAO, security_manager: SupersetSecurityManager
+    ):
+        self._dataset_dao = dataset_dao
+        self._security_manager = security_manager
+
+    def validate(self, query_context: QueryContext) -> None:
+        self._validate_actor_can_access(query_context)
+        self._validate_queries_context(query_context)
+
+    def _validate_actor_can_access(self, query_context: QueryContext) -> None:
+        sql_database: Optional[Database] = query_context.get_database()
+        if sql_database is not None:
+            self._validate_when_context_based_on_sql_database(
+                query_context, sql_database
+            )
+        else:
+            self._security_manager.raise_for_access(query_context=query_context)
+
+    def _validate_when_context_based_on_sql_database(
+        self, query_context: QueryContext, sql_database: Database
+    ) -> None:
+        if not self._actor_can_access_all_database_data(sql_database):
+            self._validate_actor_can_access_datasources_context(
+                query_context, sql_database
+            )
+
+    def _actor_can_access_all_database_data(self, sql_database: Database) -> bool:
+        return (
+            self._security_manager.can_access_all_databases()
+            or self._security_manager.can_access_all_datasources()
+            or self._security_manager.can_access_database(sql_database)
+        )
+
+    def _validate_actor_can_access_datasources_context(
+        self, query_context: QueryContext, sql_database: Database
+    ) -> None:
+        datasources = self._get_all_related_datasources(query_context, sql_database)
+        for datasource in datasources:
+            self._security_manager.raise_when_there_is_no_access_to(datasource)
+
+    def _get_all_related_datasources(
+        self, query_context: QueryContext, sql_database: Database
+    ) -> Set[BaseDatasource]:
+
+        datasources: Set[BaseDatasource] = set()
+        datasources.add(query_context.datasource)
+        for query in query_context.queries:
+            self._find_datasources_in_query(query, sql_database)
+        return datasources
+
+    def _find_datasources_in_query(
+        self, query: QueryObject, database: Database
+    ) -> Set[BaseDatasource]:
+
+        datasources: Set[BaseDatasource] = set()
+        datasource = query.get_datasource()
+        if datasource is not None:
+            datasources.add(query.datasource)  # type: ignore
+        if query.metrics:

Review comment:
       ```suggestion
           collect_from_metrics()
   ```
   

##########
File path: superset/charts/commands/query_context_validator.py
##########
@@ -0,0 +1,150 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# pylint: disable=invalid-name, no-self-use, too-few-public-methods
+from __future__ import annotations
+
+from typing import List, Optional, Set, TYPE_CHECKING
+
+from superset.charts.commands.data import QueryContextValidator
+from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
+from superset.exceptions import SupersetSecurityException
+from superset.sql_parse import ParsedQuery, Table
+
+if TYPE_CHECKING:
+    from superset import SupersetSecurityManager
+    from superset.connectors.sqla.models import SqlaTable
+    from superset.datasets.dao import DatasetDAO
+    from superset.models.core import Database
+    from superset.common.query_object import QueryObject
+    from superset.connectors.base.models import BaseDatasource
+    from superset.common.query_context import QueryContext
+    from superset.typing import Metric
+
+
+class QueryContextValidatorImpl(QueryContextValidator):
+    _dataset_dao: DatasetDAO
+    _security_manager: SupersetSecurityManager
+
+    def __init__(
+        self, dataset_dao: DatasetDAO, security_manager: SupersetSecurityManager
+    ):
+        self._dataset_dao = dataset_dao
+        self._security_manager = security_manager
+
+    def validate(self, query_context: QueryContext) -> None:
+        self._validate_actor_can_access(query_context)
+        self._validate_queries_context(query_context)
+
+    def _validate_actor_can_access(self, query_context: QueryContext) -> None:
+        sql_database: Optional[Database] = query_context.get_database()
+        if sql_database is not None:
+            self._validate_when_context_based_on_sql_database(
+                query_context, sql_database
+            )
+        else:
+            self._security_manager.raise_for_access(query_context=query_context)
+
+    def _validate_when_context_based_on_sql_database(
+        self, query_context: QueryContext, sql_database: Database
+    ) -> None:
+        if not self._actor_can_access_all_database_data(sql_database):
+            self._validate_actor_can_access_datasources_context(
+                query_context, sql_database
+            )
+
+    def _actor_can_access_all_database_data(self, sql_database: Database) -> bool:
+        return (
+            self._security_manager.can_access_all_databases()
+            or self._security_manager.can_access_all_datasources()
+            or self._security_manager.can_access_database(sql_database)
+        )
+
+    def _validate_actor_can_access_datasources_context(
+        self, query_context: QueryContext, sql_database: Database
+    ) -> None:
+        datasources = self._get_all_related_datasources(query_context, sql_database)
+        for datasource in datasources:
+            self._security_manager.raise_when_there_is_no_access_to(datasource)
+
+    def _get_all_related_datasources(
+        self, query_context: QueryContext, sql_database: Database
+    ) -> Set[BaseDatasource]:
+
+        datasources: Set[BaseDatasource] = set()
+        datasources.add(query_context.datasource)
+        for query in query_context.queries:
+            self._find_datasources_in_query(query, sql_database)
+        return datasources
+
+    def _find_datasources_in_query(
+        self, query: QueryObject, database: Database
+    ) -> Set[BaseDatasource]:
+
+        datasources: Set[BaseDatasource] = set()
+        datasource = query.get_datasource()
+        if datasource is not None:

Review comment:
       ```suggestion
           Collect_from_query_context()
   ```
   




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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e7b3539) into [master](https://codecov.io/gh/apache/superset/commit/9a8911f18c519ee80e46fdaec669ed3b26141b2f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9a8911f) will **decrease** coverage by `0.18%`.
   > The diff coverage is `43.75%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   - Coverage   76.85%   76.66%   -0.19%     
   ==========================================
     Files        1030     1031       +1     
     Lines       55017    55152     +135     
     Branches     7464     7464              
   ==========================================
   + Hits        42282    42283       +1     
   - Misses      12482    12616     +134     
     Partials      253      253              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `81.77% <43.75%> (-0.06%)` | :arrow_down: |
   | postgres | `81.78% <43.75%> (-0.12%)` | :arrow_down: |
   | python | `81.86% <43.75%> (-0.39%)` | :arrow_down: |
   | sqlite | `81.45% <43.75%> (-0.06%)` | :arrow_down: |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/common/query\_context.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2NvbnRleHQucHk=) | `88.93% <16.66%> (-1.98%)` | :arrow_down: |
   | [superset/common/query\_object.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X29iamVjdC5weQ==) | `90.75% <20.00%> (-2.11%)` | :arrow_down: |
   | [...uperset/charts/commands/query\_context\_validator.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2NvbW1hbmRzL3F1ZXJ5X2NvbnRleHRfdmFsaWRhdG9yLnB5) | `34.17% <34.17%> (ø)` | |
   | [superset/datasets/dao.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvZGFvLnB5) | `95.89% <66.66%> (-0.62%)` | :arrow_down: |
   | [superset/charts/commands/data.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2NvbW1hbmRzL2RhdGEucHk=) | `95.08% <85.71%> (-1.29%)` | :arrow_down: |
   | [superset/charts/api.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2FwaS5weQ==) | `85.97% <100.00%> (+0.14%)` | :arrow_up: |
   | [superset/tasks/async\_queries.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdGFza3MvYXN5bmNfcXVlcmllcy5weQ==) | `97.14% <100.00%> (+0.17%)` | :arrow_up: |
   | [superset/db\_engines/hive.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lcy9oaXZlLnB5) | `0.00% <0.00%> (-82.15%)` | :arrow_down: |
   | [superset/db\_engine\_specs/hive.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2hpdmUucHk=) | `69.76% <0.00%> (-17.06%)` | :arrow_down: |
   | [superset/views/database/mixins.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvbWl4aW5zLnB5) | `81.03% <0.00%> (-1.73%)` | :arrow_down: |
   | ... and [11 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [9a8911f...e7b3539](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (66ac874) into [master](https://codecov.io/gh/apache/superset/commit/aee5c9a3ea1006b194319d47c3e7f245e438ce6f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (aee5c9a) will **decrease** coverage by `0.44%`.
   > The diff coverage is `86.45%`.
   
   > :exclamation: Current head 66ac874 differs from pull request most recent head 90ac808. Consider uploading reports for the commit 90ac808 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   - Coverage   68.88%   68.43%   -0.45%     
   ==========================================
     Files        1598     1590       -8     
     Lines       65297    65082     -215     
     Branches     6952     6963      +11     
   ==========================================
   - Hits        44978    44542     -436     
   - Misses      18434    18650     +216     
   - Partials     1885     1890       +5     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `82.04% <86.45%> (-0.10%)` | :arrow_down: |
   | postgres | `82.05% <86.45%> (-0.10%)` | :arrow_down: |
   | python | `82.13% <86.45%> (-0.36%)` | :arrow_down: |
   | sqlite | `81.73% <86.45%> (-0.10%)` | :arrow_down: |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/config.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29uZmlnLnB5) | `91.53% <ø> (-0.06%)` | :arrow_down: |
   | [superset/common/query\_object.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X29iamVjdC5weQ==) | `92.13% <60.00%> (-0.93%)` | :arrow_down: |
   | [superset/datasets/dao.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvZGFvLnB5) | `93.24% <66.66%> (-0.55%)` | :arrow_down: |
   | [superset/common/query\_context.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2NvbnRleHQucHk=) | `86.15% <77.27%> (-6.58%)` | :arrow_down: |
   | [superset/tasks/async\_queries.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdGFza3MvYXN5bmNfcXVlcmllcy5weQ==) | `90.24% <83.33%> (-0.79%)` | :arrow_down: |
   | [...set/charts/data/query\_context\_validator\_factory.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvcXVlcnlfY29udGV4dF92YWxpZGF0b3JfZmFjdG9yeS5weQ==) | `85.71% <85.71%> (ø)` | |
   | [superset/charts/data/commands/get\_data\_command.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvY29tbWFuZHMvZ2V0X2RhdGFfY29tbWFuZC5weQ==) | `96.96% <87.50%> (-3.04%)` | :arrow_down: |
   | [superset/charts/data/query\_context\_validator.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvcXVlcnlfY29udGV4dF92YWxpZGF0b3IucHk=) | `89.41% <89.41%> (ø)` | |
   | [superset/charts/data/api.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvYXBpLnB5) | `88.31% <100.00%> (+0.15%)` | :arrow_up: |
   | [superset/security/manager.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc2VjdXJpdHkvbWFuYWdlci5weQ==) | `91.92% <100.00%> (-0.05%)` | :arrow_down: |
   | ... and [80 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [aee5c9a...90ac808](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (66ac874) into [master](https://codecov.io/gh/apache/superset/commit/f8a65f8001a5069ab53ce9295fb378abec66dc90?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f8a65f8) will **increase** coverage by `1.33%`.
   > The diff coverage is `86.45%`.
   
   > :exclamation: Current head 66ac874 differs from pull request most recent head dd48e73. Consider uploading reports for the commit dd48e73 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   + Coverage   67.10%   68.43%   +1.33%     
   ==========================================
     Files        1609     1590      -19     
     Lines       64897    65082     +185     
     Branches     6866     6963      +97     
   ==========================================
   + Hits        43547    44542     +995     
   + Misses      19484    18650     -834     
   - Partials     1866     1890      +24     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `82.04% <86.45%> (-0.15%)` | :arrow_down: |
   | postgres | `82.05% <86.45%> (-0.20%)` | :arrow_down: |
   | presto | `?` | |
   | python | `82.13% <86.45%> (-0.60%)` | :arrow_down: |
   | sqlite | `81.73% <86.45%> (-0.20%)` | :arrow_down: |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/config.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29uZmlnLnB5) | `91.53% <ø> (-0.11%)` | :arrow_down: |
   | [superset/common/query\_object.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X29iamVjdC5weQ==) | `92.13% <60.00%> (-3.50%)` | :arrow_down: |
   | [superset/datasets/dao.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvZGFvLnB5) | `93.24% <66.66%> (-0.55%)` | :arrow_down: |
   | [superset/common/query\_context.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2NvbnRleHQucHk=) | `86.15% <77.27%> (-6.58%)` | :arrow_down: |
   | [superset/tasks/async\_queries.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdGFza3MvYXN5bmNfcXVlcmllcy5weQ==) | `90.24% <83.33%> (-0.79%)` | :arrow_down: |
   | [...set/charts/data/query\_context\_validator\_factory.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvcXVlcnlfY29udGV4dF92YWxpZGF0b3JfZmFjdG9yeS5weQ==) | `85.71% <85.71%> (ø)` | |
   | [superset/charts/data/commands/get\_data\_command.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvY29tbWFuZHMvZ2V0X2RhdGFfY29tbWFuZC5weQ==) | `96.96% <87.50%> (-3.04%)` | :arrow_down: |
   | [superset/charts/data/query\_context\_validator.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvcXVlcnlfY29udGV4dF92YWxpZGF0b3IucHk=) | `89.41% <89.41%> (ø)` | |
   | [superset/charts/data/api.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvYXBpLnB5) | `88.31% <100.00%> (-0.51%)` | :arrow_down: |
   | [superset/security/manager.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc2VjdXJpdHkvbWFuYWdlci5weQ==) | `91.92% <100.00%> (-0.05%)` | :arrow_down: |
   | ... and [660 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [f8a65f8...dd48e73](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (66ac874) into [master](https://codecov.io/gh/apache/superset/commit/16e012fe5d791ed6aa5ab755a6386b1581fc5ebd?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (16e012f) will **decrease** coverage by `8.51%`.
   > The diff coverage is `87.79%`.
   
   > :exclamation: Current head 66ac874 differs from pull request most recent head 04b1537. Consider uploading reports for the commit 04b1537 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   - Coverage   76.95%   68.43%   -8.52%     
   ==========================================
     Files        1047     1590     +543     
     Lines       56498    65082    +8584     
     Branches     7798     6963     -835     
   ==========================================
   + Hits        43476    44542    +1066     
   - Misses      12766    18650    +5884     
   - Partials      256     1890    +1634     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `82.04% <ø> (?)` | |
   | postgres | `82.05% <ø> (+0.05%)` | :arrow_up: |
   | presto | `?` | |
   | python | `82.13% <ø> (-0.29%)` | :arrow_down: |
   | sqlite | `81.73% <ø> (?)` | |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [.../superset-ui-core/src/query/types/QueryFormData.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvUXVlcnlGb3JtRGF0YS50cw==) | `87.50% <ø> (ø)` | |
   | [.../superset-ui-core/src/query/types/QueryResponse.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvUXVlcnlSZXNwb25zZS50cw==) | `100.00% <ø> (ø)` | |
   | [.../packages/superset-ui-core/src/query/types/Time.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvVGltZS50cw==) | `100.00% <ø> (ø)` | |
   | [...packages/superset-ui-core/src/query/types/index.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvaW5kZXgudHM=) | `100.00% <ø> (ø)` | |
   | [...tend/packages/superset-ui-core/src/style/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvc3R5bGUvaW5kZXgudHN4) | `100.00% <ø> (ø)` | |
   | [...es/superset-ui-core/src/time-format/TimeFormats.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHMudHM=) | `100.00% <ø> (ø)` | |
   | [...-core/src/time-format/TimeFormatsForGranularity.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHNGb3JHcmFudWxhcml0eS50cw==) | `100.00% <ø> (ø)` | |
   | [.../superset-ui-core/src/time-format/TimeFormatter.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHRlci50cw==) | `95.23% <ø> (ø)` | |
   | [...t-ui-core/src/time-format/TimeFormatterRegistry.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHRlclJlZ2lzdHJ5LnRz) | `94.11% <ø> (ø)` | |
   | [.../src/time-format/TimeFormatterRegistrySingleton.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHRlclJlZ2lzdHJ5U2luZ2xldG9uLnRz) | `85.71% <ø> (ø)` | |
   | ... and [1135 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [16e012f...04b1537](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c430381) into [master](https://codecov.io/gh/apache/superset/commit/16e012fe5d791ed6aa5ab755a6386b1581fc5ebd?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (16e012f) will **decrease** coverage by `8.53%`.
   > The diff coverage is `87.79%`.
   
   > :exclamation: Current head c430381 differs from pull request most recent head 5f45fc1. Consider uploading reports for the commit 5f45fc1 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   - Coverage   76.95%   68.42%   -8.54%     
   ==========================================
     Files        1047     1590     +543     
     Lines       56498    65082    +8584     
     Branches     7798     6963     -835     
   ==========================================
   + Hits        43476    44530    +1054     
   - Misses      12766    18662    +5896     
   - Partials      256     1890    +1634     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `82.04% <ø> (?)` | |
   | postgres | `82.05% <ø> (+0.05%)` | :arrow_up: |
   | presto | `?` | |
   | python | `82.09% <ø> (-0.33%)` | :arrow_down: |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [.../superset-ui-core/src/query/types/QueryFormData.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvUXVlcnlGb3JtRGF0YS50cw==) | `87.50% <ø> (ø)` | |
   | [.../superset-ui-core/src/query/types/QueryResponse.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvUXVlcnlSZXNwb25zZS50cw==) | `100.00% <ø> (ø)` | |
   | [.../packages/superset-ui-core/src/query/types/Time.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvVGltZS50cw==) | `100.00% <ø> (ø)` | |
   | [...packages/superset-ui-core/src/query/types/index.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvaW5kZXgudHM=) | `100.00% <ø> (ø)` | |
   | [...tend/packages/superset-ui-core/src/style/index.tsx](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvc3R5bGUvaW5kZXgudHN4) | `100.00% <ø> (ø)` | |
   | [...es/superset-ui-core/src/time-format/TimeFormats.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHMudHM=) | `100.00% <ø> (ø)` | |
   | [...-core/src/time-format/TimeFormatsForGranularity.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHNGb3JHcmFudWxhcml0eS50cw==) | `100.00% <ø> (ø)` | |
   | [.../superset-ui-core/src/time-format/TimeFormatter.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHRlci50cw==) | `95.23% <ø> (ø)` | |
   | [...t-ui-core/src/time-format/TimeFormatterRegistry.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHRlclJlZ2lzdHJ5LnRz) | `94.11% <ø> (ø)` | |
   | [.../src/time-format/TimeFormatterRegistrySingleton.ts](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvdGltZS1mb3JtYXQvVGltZUZvcm1hdHRlclJlZ2lzdHJ5U2luZ2xldG9uLnRz) | `85.71% <ø> (ø)` | |
   | ... and [1132 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [16e012f...5f45fc1](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] ofekisr commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
ofekisr commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r759080431



##########
File path: superset/charts/data/commands/get_data_command.py
##########
@@ -14,6 +14,8 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+from __future__ import annotations
+

Review comment:
       https://docs.python.org/3/library/__future__.html
   
   ![image](https://user-images.githubusercontent.com/35701650/144020171-d5ecaa5e-c8df-4aac-8499-8455b071f98f.png)
   




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


[GitHub] [superset] ofekisr commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
ofekisr commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r759095783



##########
File path: superset/security/manager.py
##########
@@ -1047,17 +1048,23 @@ def raise_for_access(
 
             assert datasource
 
-            if not (
-                self.can_access_schema(datasource)
-                or self.can_access("datasource_access", datasource.perm or "")
-                or (
-                    feature_flag_manager.is_feature_enabled("DASHBOARD_RBAC")
-                    and self.can_access_based_on_dashboard(datasource)
-                )
-            ):
-                raise SupersetSecurityException(
-                    self.get_datasource_access_error_object(datasource)
-                )
+            self.raise_when_there_is_no_access_to(datasource)
+
+    def raise_when_there_is_no_access_to(self, datasource: BaseDatasource) -> None:

Review comment:
       @etr2460 
   You gave a good reference, but I still think is an anti-pattern, and they are wrong too.
   but with that reference, it should be discussed in a different context not in that PR
   
   @betodealmeida 
   There is a conflict between two principles: 
   consistency vs you should always leave the code you have just modified cleaner than it was, a good catch and currently, I don't have a good argument or opinion on what principle is stronger. 
   
   I'll rename it 
   




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


[GitHub] [superset] betodealmeida commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
betodealmeida commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r758521458



##########
File path: superset/security/manager.py
##########
@@ -974,14 +976,14 @@ def set_perm(  # pylint: disable=unused-argument
                 )
 
     def raise_for_access(
-        # pylint: disable=too-many-arguments,too-many-locals
+        # pylint: disable=too-many-arguments
         self,
-        database: Optional["Database"] = None,
-        datasource: Optional["BaseDatasource"] = None,
-        query: Optional["Query"] = None,
-        query_context: Optional["QueryContext"] = None,
-        table: Optional["Table"] = None,
-        viz: Optional["BaseViz"] = None,
+        database: Optional[Database] = None,
+        datasource: Optional[BaseDatasource] = None,
+        query: Optional[Query] = None,
+        query_context: Optional[QueryContext] = None,
+        table: Optional[Table] = None,
+        viz: Optional[BaseViz] = None,

Review comment:
       If the imports are inside an `if TYPE_CHECKING` then you need to use a string, otherwise you get a `NameError`.




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


[GitHub] [superset] codecov[bot] edited a comment on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-937694232


   # [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#16991](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (66ac874) into [master](https://codecov.io/gh/apache/superset/commit/f8a65f8001a5069ab53ce9295fb378abec66dc90?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f8a65f8) will **increase** coverage by `1.33%`.
   > The diff coverage is `86.45%`.
   
   > :exclamation: Current head 66ac874 differs from pull request most recent head e6b9d49. Consider uploading reports for the commit e6b9d49 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/16991/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #16991      +/-   ##
   ==========================================
   + Coverage   67.10%   68.43%   +1.33%     
   ==========================================
     Files        1609     1590      -19     
     Lines       64897    65082     +185     
     Branches     6866     6963      +97     
   ==========================================
   + Hits        43547    44542     +995     
   + Misses      19484    18650     -834     
   - Partials     1866     1890      +24     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `82.04% <86.45%> (-0.15%)` | :arrow_down: |
   | postgres | `82.05% <86.45%> (-0.20%)` | :arrow_down: |
   | presto | `?` | |
   | python | `82.13% <86.45%> (-0.60%)` | :arrow_down: |
   | sqlite | `81.73% <86.45%> (-0.20%)` | :arrow_down: |
   
   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=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/config.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29uZmlnLnB5) | `91.53% <ø> (-0.11%)` | :arrow_down: |
   | [superset/common/query\_object.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X29iamVjdC5weQ==) | `92.13% <60.00%> (-3.50%)` | :arrow_down: |
   | [superset/datasets/dao.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvZGFvLnB5) | `93.24% <66.66%> (-0.55%)` | :arrow_down: |
   | [superset/common/query\_context.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2NvbnRleHQucHk=) | `86.15% <77.27%> (-6.58%)` | :arrow_down: |
   | [superset/tasks/async\_queries.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdGFza3MvYXN5bmNfcXVlcmllcy5weQ==) | `90.24% <83.33%> (-0.79%)` | :arrow_down: |
   | [...set/charts/data/query\_context\_validator\_factory.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvcXVlcnlfY29udGV4dF92YWxpZGF0b3JfZmFjdG9yeS5weQ==) | `85.71% <85.71%> (ø)` | |
   | [superset/charts/data/commands/get\_data\_command.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvY29tbWFuZHMvZ2V0X2RhdGFfY29tbWFuZC5weQ==) | `96.96% <87.50%> (-3.04%)` | :arrow_down: |
   | [superset/charts/data/query\_context\_validator.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvcXVlcnlfY29udGV4dF92YWxpZGF0b3IucHk=) | `89.41% <89.41%> (ø)` | |
   | [superset/charts/data/api.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2RhdGEvYXBpLnB5) | `88.31% <100.00%> (-0.51%)` | :arrow_down: |
   | [superset/security/manager.py](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc2VjdXJpdHkvbWFuYWdlci5weQ==) | `91.92% <100.00%> (-0.05%)` | :arrow_down: |
   | ... and [660 more](https://codecov.io/gh/apache/superset/pull/16991/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [f8a65f8...e6b9d49](https://codecov.io/gh/apache/superset/pull/16991?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] jayakrishnankk commented on pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
jayakrishnankk commented on pull request #16991:
URL: https://github.com/apache/superset/pull/16991#issuecomment-984849800


   @craig-rueda - requesting review. bumping this.


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


[GitHub] [superset] villebro commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
villebro commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r763966066



##########
File path: tests/common/query_context_generator.py
##########
@@ -199,16 +199,16 @@ def get_query_object(
     query_name: str, add_postprocessing_operations: bool, add_time_offsets: bool,
 ) -> Dict[str, Any]:
     if query_name not in QUERY_OBJECTS:
-        raise Exception(f"QueryObject fixture not defined for datasource: {query_name}")
-    obj = QUERY_OBJECTS[query_name]
-
-    # apply overrides
-    if ":" in query_name:
-        parent_query_name = query_name.split(":")[0]
-        obj = {
-            **QUERY_OBJECTS[parent_query_name],
-            **obj,
-        }
+        obj = QUERY_OBJECTS[query_name]

Review comment:
       I don't understand the point of this change - if `query_name not in QUERY_OBJECTS`, we probably can't assign `obj = QUERY_OBJECTS[query_name]`? Consequently, the code below becomes unreachable, raising the question if it's needed anymore




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


[GitHub] [superset] ofekisr commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
ofekisr commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r732135955



##########
File path: superset/charts/api.py
##########
@@ -644,6 +646,11 @@ def get_data(self, pk: int) -> Response:
 
         return self.get_data_response(command, form_data=form_data)
 
+    def _create_chart_data_command(self) -> ChartDataCommand:
+        return ChartDataCommand(
+            QueryContextValidatorImpl(DatasetDAO(), security_manager)  # type: ignore

Review comment:
       Security manager is a local proxy not a real security manager 




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


[GitHub] [superset] craig-rueda commented on a change in pull request #16991: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
craig-rueda commented on a change in pull request #16991:
URL: https://github.com/apache/superset/pull/16991#discussion_r732101968



##########
File path: superset/charts/commands/query_context_validator.py
##########
@@ -0,0 +1,168 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# pylint: disable=invalid-name, no-self-use, too-few-public-methods
+from __future__ import annotations
+
+from typing import List, Optional, Set, TYPE_CHECKING
+
+from superset.charts.commands.data import QueryContextValidator
+from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
+from superset.exceptions import SupersetSecurityException
+from superset.sql_parse import ParsedQuery, Table
+
+if TYPE_CHECKING:
+    from superset import SupersetSecurityManager
+    from superset.connectors.sqla.models import SqlaTable
+    from superset.datasets.dao import DatasetDAO
+    from superset.models.core import Database
+    from superset.common.query_object import QueryObject
+    from superset.connectors.base.models import BaseDatasource
+    from superset.common.query_context import QueryContext
+    from superset.typing import Metric
+
+
+class QueryContextValidatorImpl(QueryContextValidator):
+    _dataset_dao: DatasetDAO
+    _security_manager: SupersetSecurityManager
+
+    def __init__(
+        self, dataset_dao: DatasetDAO, security_manager: SupersetSecurityManager
+    ):
+        self._dataset_dao = dataset_dao
+        self._security_manager = security_manager
+
+    def validate(self, query_context: QueryContext) -> None:
+        self._validate_actor_can_access(query_context)
+        self._validate_queries_context(query_context)
+
+    def _validate_actor_can_access(self, query_context: QueryContext) -> None:
+        sql_database: Optional[Database] = query_context.get_database()
+        if sql_database is not None:
+            self._validate_when_context_based_on_sql_database(
+                query_context, sql_database
+            )
+        else:
+            self._security_manager.raise_for_access(query_context=query_context)
+
+    def _validate_when_context_based_on_sql_database(
+        self, query_context: QueryContext, sql_database: Database
+    ) -> None:
+        if not self._actor_can_access_all_database_data(sql_database):
+            self._validate_actor_can_access_datasources_context(
+                query_context, sql_database
+            )
+
+    def _actor_can_access_all_database_data(self, sql_database: Database) -> bool:
+        return (
+            self._security_manager.can_access_all_databases()
+            or self._security_manager.can_access_all_datasources()
+            or self._security_manager.can_access_database(sql_database)
+        )
+
+    def _validate_actor_can_access_datasources_context(
+        self, query_context: QueryContext, sql_database: Database
+    ) -> None:
+        datasources = self._get_all_related_datasources(query_context, sql_database)
+        for datasource in datasources:
+            self._security_manager.raise_when_there_is_no_access_to(datasource)
+
+    def _get_all_related_datasources(
+        self, query_context: QueryContext, sql_database: Database
+    ) -> Set[BaseDatasource]:
+
+        datasources: Set[BaseDatasource] = set()
+        datasources.add(query_context.datasource)

Review comment:
       Nit: set comprehension would be easier to read here.




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