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 2022/04/18 10:59:07 UTC

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

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

   <!---
   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] amitmiran137 commented on a diff in pull request #19753: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
amitmiran137 commented on code in PR #19753:
URL: https://github.com/apache/superset/pull/19753#discussion_r854227070


##########
tests/integration_tests/databases/api_tests.py:
##########
@@ -1111,6 +1111,7 @@ def test_get_allow_file_upload_true_csv(self):
     def mock_empty_csv_function(d, user):
         return []
 
+    @pytest.mark.skip("the excepted count is not well defined")

Review Comment:
   I don't think it is ok to create a test dependent on side effects of other tests .
   
   If this test is that unstable we should remove until you can figure out a proper quality solution 
   
   @villebro WDYT?



-- 
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 #19753: fix(QueryContext): validation does not validate query_context metrics

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

   @AAfghahi told me to change back the excepted result of the failed test until he will figure it out.
   instead of it, I mark the test to be skipped 


-- 
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] AAfghahi commented on a diff in pull request #19753: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
AAfghahi commented on code in PR #19753:
URL: https://github.com/apache/superset/pull/19753#discussion_r854217388


##########
tests/integration_tests/databases/api_tests.py:
##########
@@ -1111,6 +1111,7 @@ def test_get_allow_file_upload_true_csv(self):
     def mock_empty_csv_function(d, user):
         return []
 
+    @pytest.mark.skip("the excepted count is not well defined")

Review Comment:
   Looked at this today in the context of your PR. The unfortunate fact is that this is a filter that depends on side effects from other tests, since it is just querying every database. When I created the test the value was consistently 0 in my local test environment, but it failed in the CI with a count of 1, which we attributed to these side effects. I think it is good to change this to 0 and not skip 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] ofekisr commented on a diff in pull request #19753: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
ofekisr commented on code in PR #19753:
URL: https://github.com/apache/superset/pull/19753#discussion_r854225982


##########
tests/integration_tests/databases/api_tests.py:
##########
@@ -1111,6 +1111,7 @@ def test_get_allow_file_upload_true_csv(self):
     def mock_empty_csv_function(d, user):
         return []
 
+    @pytest.mark.skip("the excepted count is not well defined")

Review Comment:
   @villebro @amitmiran137 let me know what to do
   1. change back to '0'
   2. keep it as skipped
   3. remove the test
   
   



-- 
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] dpgaspar commented on a diff in pull request #19753: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
dpgaspar commented on code in PR #19753:
URL: https://github.com/apache/superset/pull/19753#discussion_r875608610


##########
superset/charts/data/commands/command_factory.py:
##########
@@ -0,0 +1,55 @@
+#  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.
+from __future__ import annotations
+
+from typing import ClassVar, TYPE_CHECKING
+
+from .get_data_command import ChartDataCommand
+
+if TYPE_CHECKING:
+    from superset.commands.base import BaseCommand
+    from superset.common.query_context import QueryContext
+
+    from ..query_context_validators.validaor_factory import QueryContextValidatorFactory

Review Comment:
   We avoid using relative imports
   there's seems to be a typo also: `validaor_factory`



-- 
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 #19753: fix(QueryContext): validation does not validate query_context metrics

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

   # [Codecov](https://codecov.io/gh/apache/superset/pull/19753?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 [#19753](https://codecov.io/gh/apache/superset/pull/19753?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (96dcc88) into [master](https://codecov.io/gh/apache/superset/commit/cf5145918ba6da3b8b803bed86ad7ca22d50494a?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (cf51459) will **decrease** coverage by `12.75%`.
   > The diff coverage is `n/a`.
   
   > :exclamation: Current head 96dcc88 differs from pull request most recent head 913e4f1. Consider uploading reports for the commit 913e4f1 to get more accurate results
   
   ```diff
   @@             Coverage Diff             @@
   ##           master   #19753       +/-   ##
   ===========================================
   - Coverage   66.51%   53.75%   -12.76%     
   ===========================================
     Files        1687     1687               
     Lines       64618    64618               
     Branches     6646     6646               
   ===========================================
   - Hits        42978    34735     -8243     
   - Misses      19940    28183     +8243     
     Partials     1700     1700               
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `52.69% <0.00%> (ø)` | |
   | mysql | `?` | |
   | postgres | `?` | |
   | presto | `?` | |
   | python | `56.41% <0.00%> (-26.02%)` | :arrow_down: |
   | sqlite | `?` | |
   | unit | `47.75% <0.00%> (ø)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/19753?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/utils/dashboard\_import\_export.py](https://codecov.io/gh/apache/superset/pull/19753/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdXRpbHMvZGFzaGJvYXJkX2ltcG9ydF9leHBvcnQucHk=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [superset/key\_value/commands/upsert.py](https://codecov.io/gh/apache/superset/pull/19753/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQva2V5X3ZhbHVlL2NvbW1hbmRzL3Vwc2VydC5weQ==) | `0.00% <0.00%> (-89.59%)` | :arrow_down: |
   | [superset/key\_value/commands/update.py](https://codecov.io/gh/apache/superset/pull/19753/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQva2V5X3ZhbHVlL2NvbW1hbmRzL3VwZGF0ZS5weQ==) | `0.00% <0.00%> (-89.37%)` | :arrow_down: |
   | [superset/key\_value/commands/delete.py](https://codecov.io/gh/apache/superset/pull/19753/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQva2V5X3ZhbHVlL2NvbW1hbmRzL2RlbGV0ZS5weQ==) | `0.00% <0.00%> (-85.30%)` | :arrow_down: |
   | [superset/key\_value/commands/delete\_expired.py](https://codecov.io/gh/apache/superset/pull/19753/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQva2V5X3ZhbHVlL2NvbW1hbmRzL2RlbGV0ZV9leHBpcmVkLnB5) | `0.00% <0.00%> (-80.77%)` | :arrow_down: |
   | [superset/dashboards/commands/importers/v0.py](https://codecov.io/gh/apache/superset/pull/19753/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGFzaGJvYXJkcy9jb21tYW5kcy9pbXBvcnRlcnMvdjAucHk=) | `14.79% <0.00%> (-75.15%)` | :arrow_down: |
   | [superset/datasets/commands/importers/v0.py](https://codecov.io/gh/apache/superset/pull/19753/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvaW1wb3J0ZXJzL3YwLnB5) | `24.82% <0.00%> (-68.80%)` | :arrow_down: |
   | [superset/databases/commands/test\_connection.py](https://codecov.io/gh/apache/superset/pull/19753/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL3Rlc3RfY29ubmVjdGlvbi5weQ==) | `31.42% <0.00%> (-68.58%)` | :arrow_down: |
   | [superset/datasets/commands/update.py](https://codecov.io/gh/apache/superset/pull/19753/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvdXBkYXRlLnB5) | `25.88% <0.00%> (-68.24%)` | :arrow_down: |
   | [superset/datasets/commands/create.py](https://codecov.io/gh/apache/superset/pull/19753/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvY3JlYXRlLnB5) | `30.18% <0.00%> (-67.93%)` | :arrow_down: |
   | ... and [266 more](https://codecov.io/gh/apache/superset/pull/19753/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/19753?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/19753?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 [cf51459...913e4f1](https://codecov.io/gh/apache/superset/pull/19753?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 closed pull request #19753: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
ofekisr closed pull request #19753: fix(QueryContext): validation does not validate query_context metrics
URL: https://github.com/apache/superset/pull/19753


-- 
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 diff in pull request #19753: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
amitmiran137 commented on code in PR #19753:
URL: https://github.com/apache/superset/pull/19753#discussion_r854227070


##########
tests/integration_tests/databases/api_tests.py:
##########
@@ -1111,6 +1111,7 @@ def test_get_allow_file_upload_true_csv(self):
     def mock_empty_csv_function(d, user):
         return []
 
+    @pytest.mark.skip("the excepted count is not well defined")

Review Comment:
   I don't think it is ok to create a test dependent on side effects of other tests .
   
   If this test is that in stable we should remove until you can figure out a proper quality solution 
   
   @villebro WDYT?



-- 
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] eschutho commented on a diff in pull request #19753: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
eschutho commented on code in PR #19753:
URL: https://github.com/apache/superset/pull/19753#discussion_r875338511


##########
superset/charts/data/query_context_validators/validaor_factory.py:
##########
@@ -0,0 +1,56 @@
+#  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.
+from __future__ import annotations
+
+from typing import TYPE_CHECKING
+
+from superset import feature_flag_manager
+
+from .access_validators import SecurityManagerWrapper, SqlDatabaseBasedAccessValidator
+from .impl import QueryContextValidatorImpl, QueryContextValidatorWrapper
+
+if TYPE_CHECKING:
+    from superset.datasets.dao import DatasetDAO
+    from superset.security.manager import SupersetSecurityManager
+
+    from . import QueryContextValidator
+
+
+class QueryContextValidatorFactory:  # pylint: disable=too-few-public-methods
+    _security_manager: SupersetSecurityManager
+    _dataset_dao: DatasetDAO
+
+    def __init__(
+        self, security_manager: SupersetSecurityManager, dataset_dao: DatasetDAO
+    ):
+        self._security_manager = security_manager
+        self._dataset_dao = dataset_dao
+
+    def make(self, is_sql_db: bool = False) -> QueryContextValidator:
+        if feature_flag_manager.is_feature_enabled(
+            "QUERY_CONTEXT_VALIDATION_SQL_EXPRESSION"
+        ):
+            access_validator = self._make_access_validator(is_sql_db)
+            return QueryContextValidatorImpl(access_validator)
+        return QueryContextValidatorWrapper()
+
+    def _make_access_validator(self, is_sql_db: bool) -> QueryContextValidator:
+        if is_sql_db:

Review Comment:
   are you checking here that the db is sql and not no-sql Druid? If so, we've removed native Druid support in 2.0. 



-- 
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] dpgaspar commented on a diff in pull request #19753: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
dpgaspar commented on code in PR #19753:
URL: https://github.com/apache/superset/pull/19753#discussion_r875608610


##########
superset/charts/data/commands/command_factory.py:
##########
@@ -0,0 +1,55 @@
+#  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.
+from __future__ import annotations
+
+from typing import ClassVar, TYPE_CHECKING
+
+from .get_data_command import ChartDataCommand
+
+if TYPE_CHECKING:
+    from superset.commands.base import BaseCommand
+    from superset.common.query_context import QueryContext
+
+    from ..query_context_validators.validaor_factory import QueryContextValidatorFactory

Review Comment:
   We avoid using relative imports



-- 
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] akzarma commented on pull request #19753: fix(QueryContext): validation does not validate query_context metrics

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

   .


-- 
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 #19753: fix(QueryContext): validation does not validate query_context metrics

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

   @AAfghahi 
   please review why your test is failed since #19700 
   I don't find reason 


-- 
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] zhaoyongjie commented on a diff in pull request #19753: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on code in PR #19753:
URL: https://github.com/apache/superset/pull/19753#discussion_r876517735


##########
superset/charts/data/commands/command_factory.py:
##########
@@ -0,0 +1,55 @@
+#  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.
+from __future__ import annotations
+
+from typing import ClassVar, TYPE_CHECKING
+
+from .get_data_command import ChartDataCommand
+
+if TYPE_CHECKING:
+    from superset.commands.base import BaseCommand
+    from superset.common.query_context import QueryContext
+
+    from ..query_context_validators.validaor_factory import QueryContextValidatorFactory
+
+
+class GetChartDataCommandFactory:
+    _instance: ClassVar[GetChartDataCommandFactory]
+
+    _validator_factory: QueryContextValidatorFactory
+
+    @classmethod
+    def init(cls, validator_factory: QueryContextValidatorFactory) -> None:
+        cls._instance = GetChartDataCommandFactory(validator_factory)
+
+    def __init__(self, validator_factory: QueryContextValidatorFactory):
+        self._validator_factory = validator_factory
+
+    @classmethod
+    def make(cls, query_context: QueryContext) -> BaseCommand:
+        if cls._instance is None:
+            raise RuntimeError("GetChartDataCommandFactory was not initialized")

Review Comment:
   Do we really need to make so many constructors?



-- 
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] eschutho commented on a diff in pull request #19753: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
eschutho commented on code in PR #19753:
URL: https://github.com/apache/superset/pull/19753#discussion_r875348514


##########
superset/charts/data/commands/command_factory.py:
##########
@@ -0,0 +1,55 @@
+#  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.
+from __future__ import annotations
+
+from typing import ClassVar, TYPE_CHECKING
+
+from .get_data_command import ChartDataCommand
+
+if TYPE_CHECKING:
+    from superset.commands.base import BaseCommand
+    from superset.common.query_context import QueryContext
+
+    from ..query_context_validators.validaor_factory import QueryContextValidatorFactory
+
+
+class GetChartDataCommandFactory:
+    _instance: ClassVar[GetChartDataCommandFactory]
+
+    _validator_factory: QueryContextValidatorFactory
+
+    @classmethod
+    def init(cls, validator_factory: QueryContextValidatorFactory) -> None:
+        cls._instance = GetChartDataCommandFactory(validator_factory)
+
+    def __init__(self, validator_factory: QueryContextValidatorFactory):
+        self._validator_factory = validator_factory
+
+    @classmethod
+    def make(cls, query_context: QueryContext) -> BaseCommand:
+        if cls._instance is None:
+            raise RuntimeError("GetChartDataCommandFactory was not initialized")
+        return cls._instance._make(query_context)
+
+    def _make(self, query_context: QueryContext) -> BaseCommand:
+        validator = self._validator_factory.make(self._is_use_sql_db(query_context))
+        return ChartDataCommand(query_context, validator)

Review Comment:
   I'm wondering if this factory abstraction is necessary for the validation or if this is something we can just put into the command?



-- 
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 closed pull request #19753: fix(QueryContext): validation does not validate query_context metrics

Posted by GitBox <gi...@apache.org>.
ofekisr closed pull request #19753: fix(QueryContext): validation does not validate query_context metrics
URL: https://github.com/apache/superset/pull/19753


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