You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "eschutho (via GitHub)" <gi...@apache.org> on 2023/10/28 00:31:11 UTC

[PR] chore: clean up mutate function into helpers mixin [superset]

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

   <!---
   Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   I need to make some changes to the mutator, so I'm starting off by removing some duplicate code and writing tests. No functional changes. 
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   ### TESTING INSTRUCTIONS
   Tests added
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] chore: clean up mutate function into helpers mixin [superset]

Posted by "john-bodley (via GitHub)" <gi...@apache.org>.
john-bodley commented on code in PR #25785:
URL: https://github.com/apache/superset/pull/25785#discussion_r1387179066


##########
superset/models/helpers.py:
##########
@@ -875,7 +875,9 @@ def mutate_query_from_config(self, sql: str) -> str:
         """Apply config's SQL_QUERY_MUTATOR
 
         Typically adds comments to the query with context"""
-        if sql_query_mutator := config["SQL_QUERY_MUTATOR"]:
+        if (sql_query_mutator := config.get("SQL_QUERY_MUTATOR")) and not config.get(
+            "MUTATE_AFTER_SPLIT"
+        ):

Review Comment:
   ```suggestion
   ```



##########
superset/models/helpers.py:
##########
@@ -875,7 +875,9 @@ def mutate_query_from_config(self, sql: str) -> str:
         """Apply config's SQL_QUERY_MUTATOR
 
         Typically adds comments to the query with context"""
-        if sql_query_mutator := config["SQL_QUERY_MUTATOR"]:
+        if (sql_query_mutator := config.get("SQL_QUERY_MUTATOR")) and not config.get(
+            "MUTATE_AFTER_SPLIT"

Review Comment:
   ```suggestion
   ```



##########
superset/models/helpers.py:
##########
@@ -875,7 +875,9 @@ def mutate_query_from_config(self, sql: str) -> str:
         """Apply config's SQL_QUERY_MUTATOR
 
         Typically adds comments to the query with context"""
-        if sql_query_mutator := config["SQL_QUERY_MUTATOR"]:
+        if (sql_query_mutator := config.get("SQL_QUERY_MUTATOR")) and not config.get(

Review Comment:
   @eschutho both these keys are defined in `config.py` and thus there's no need to use `.get()`.



##########
superset/models/helpers.py:
##########
@@ -875,7 +875,9 @@ def mutate_query_from_config(self, sql: str) -> str:
         """Apply config's SQL_QUERY_MUTATOR
 
         Typically adds comments to the query with context"""
-        if sql_query_mutator := config["SQL_QUERY_MUTATOR"]:
+        if (sql_query_mutator := config.get("SQL_QUERY_MUTATOR")) and not config.get(

Review Comment:
   ```suggestion
           if (sql_query_mutator := config["SQL_QUERY_MUTATOR"]) and not config["MUTATE_AFTER_SPLIT"]):
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] chore: clean up mutate function into helpers mixin [superset]

Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho commented on code in PR #25785:
URL: https://github.com/apache/superset/pull/25785#discussion_r1395026946


##########
superset/models/helpers.py:
##########
@@ -875,7 +875,9 @@ def mutate_query_from_config(self, sql: str) -> str:
         """Apply config's SQL_QUERY_MUTATOR
 
         Typically adds comments to the query with context"""
-        if sql_query_mutator := config["SQL_QUERY_MUTATOR"]:
+        if (sql_query_mutator := config.get("SQL_QUERY_MUTATOR")) and not config.get(

Review Comment:
   Thank 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


Re: [PR] chore: clean up mutate function into helpers mixin [superset]

Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho commented on code in PR #25785:
URL: https://github.com/apache/superset/pull/25785#discussion_r1568006394


##########
superset/models/helpers.py:
##########
@@ -875,7 +875,9 @@ def mutate_query_from_config(self, sql: str) -> str:
         """Apply config's SQL_QUERY_MUTATOR
 
         Typically adds comments to the query with context"""
-        if sql_query_mutator := config["SQL_QUERY_MUTATOR"]:
+        if (sql_query_mutator := config.get("SQL_QUERY_MUTATOR")) and not config.get(
+            "MUTATE_AFTER_SPLIT"

Review Comment:
   @john-bodley I'm circling back to this old PR to see if I can get it merged. Do you think this statement needs to be removed? I copied it over from `superset/connectors/sqla/models.py` when drying up this 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


Re: [PR] chore: clean up mutate function into helpers mixin [superset]

Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho commented on code in PR #25785:
URL: https://github.com/apache/superset/pull/25785#discussion_r1376661334


##########
superset/models/helpers.py:
##########
@@ -875,7 +875,9 @@ def mutate_query_from_config(self, sql: str) -> str:
         """Apply config's SQL_QUERY_MUTATOR
 
         Typically adds comments to the query with context"""
-        if sql_query_mutator := config["SQL_QUERY_MUTATOR"]:
+        if (sql_query_mutator := config.get("SQL_QUERY_MUTATOR")) and not config.get(
+            "MUTATE_AFTER_SPLIT"
+        ):

Review Comment:
   This was pulled in from superset/connectors/sqla/models.py



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] chore: clean up mutate function into helpers mixin [superset]

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

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/25785?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   All modified and coverable lines are covered by tests :white_check_mark:
   > Comparison is base [(`d20b60e`)](https://app.codecov.io/gh/apache/superset/commit/d20b60edd4aaa604b520a7d09a9cf899cef6d61f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 69.05% compared to head [(`6c7707c`)](https://app.codecov.io/gh/apache/superset/pull/25785?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 66.32%.
   > Report is 8 commits behind head on master.
   
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #25785      +/-   ##
   ==========================================
   - Coverage   69.05%   66.32%   -2.73%     
   ==========================================
     Files        1938     1938              
     Lines       75852    75801      -51     
     Branches     8427     8427              
   ==========================================
   - Hits        52381    50277    -2104     
   - Misses      21301    23354    +2053     
     Partials     2170     2170              
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/25785/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [hive](https://app.codecov.io/gh/apache/superset/pull/25785/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `53.68% <100.00%> (+0.02%)` | :arrow_up: |
   | [mysql](https://app.codecov.io/gh/apache/superset/pull/25785/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [postgres](https://app.codecov.io/gh/apache/superset/pull/25785/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [presto](https://app.codecov.io/gh/apache/superset/pull/25785/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `53.63% <100.00%> (+0.02%)` | :arrow_up: |
   | [python](https://app.codecov.io/gh/apache/superset/pull/25785/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `77.24% <100.00%> (-5.66%)` | :arrow_down: |
   | [sqlite](https://app.codecov.io/gh/apache/superset/pull/25785/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `76.94% <100.00%> (-0.03%)` | :arrow_down: |
   | [unit](https://app.codecov.io/gh/apache/superset/pull/25785/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/25785?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org