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/06/22 14:21:38 UTC

[GitHub] [superset] codemaster08240328 opened a new pull request, #20465: fix: Custom sql issue in table viz with raw records

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

   <!---
   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 -->
   This issue was happened because in backend, when we validate sql, we got wrong sql string from columns.
   
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   AFTER:
   [Best JSON Viewer and JSON Beautifier Online - 22 June 2022 - Watch Video](https://www.loom.com/share/a90e2c84acd541438cd2f1b6106b9cf6)
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   1. Create a Table with Raw Records as the type
   2. Drag in a metric
   3. Add a column using Custom SQL
   4. You can try adding a constant or just type out any column name
   
   ### 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] github-actions[bot] commented on pull request #20465: fix: Custom sql issue in table viz with raw records

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

   Ephemeral environment shutdown and build artifacts deleted.


-- 
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] rusackas closed pull request #20465: fix: Custom sql issue in table viz with raw records

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed pull request #20465: fix: Custom sql issue in table viz with raw records
URL: https://github.com/apache/superset/pull/20465


-- 
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] github-actions[bot] commented on pull request #20465: fix: Custom sql issue in table viz with raw records

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

   @yousoph Ephemeral environment spinning up at http://34.214.231.184:8080. Credentials are `admin`/`admin`. Please allow several minutes for bootstrapping and startup.


-- 
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] yousoph commented on pull request #20465: fix: Custom sql issue in table viz with raw records

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

   /testenv up


-- 
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 #20465: fix: Custom sql issue in table viz with raw records

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


##########
superset/connectors/sqla/models.py:
##########
@@ -1379,15 +1379,23 @@ def get_sqla_query(  # pylint: disable=too-many-arguments,too-many-locals,too-ma
                 select_exprs.append(outer)
         elif columns:
             for selected in columns:
-                selected = validate_adhoc_subquery(
-                    selected,
+                selected_query = (
+                    selected["sqlExpression"]
+                    if "sqlExpression" in selected
+                    else selected
+                )
+                label_expected = selected["label"] if "label" in selected else selected
+                selected_query = validate_adhoc_subquery(
+                    selected_query,
                     self.database_id,
                     self.schema,
                 )
                 select_exprs.append(
-                    columns_by_name[selected].get_sqla_col()
-                    if selected in columns_by_name
-                    else self.make_sqla_column_compatible(literal_column(selected))
+                    columns_by_name[selected_query].get_sqla_col()
+                    if selected_query in columns_by_name
+                    else self.make_sqla_column_compatible(
+                        literal_column(selected_query), label_expected
+                    )
                 )

Review Comment:
   There is a method for converting AdHoc Column to ColumnClause, for instance:
   
   ```python
                   if is_adhoc_column(selected):
                       select_exprs.append(self.adhoc_column_to_sqla(selected))
                       continue
   ```



-- 
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 #20465: fix: Custom sql issue in table viz with raw records

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

   # [Codecov](https://codecov.io/gh/apache/superset/pull/20465?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 [#20465](https://codecov.io/gh/apache/superset/pull/20465?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (8321075) into [master](https://codecov.io/gh/apache/superset/commit/467d8ef89ea11dcfc4cd67d88a514886254820d2?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (467d8ef) will **decrease** coverage by `11.90%`.
   > The diff coverage is `70.21%`.
   
   > :exclamation: Current head 8321075 differs from pull request most recent head 199f233. Consider uploading reports for the commit 199f233 to get more accurate results
   
   ```diff
   @@             Coverage Diff             @@
   ##           master   #20465       +/-   ##
   ===========================================
   - Coverage   66.70%   54.79%   -11.91%     
   ===========================================
     Files        1739     1739               
     Lines       65135    65132        -3     
     Branches     6897     6898        +1     
   ===========================================
   - Hits        43450    35691     -7759     
   - Misses      19932    27691     +7759     
   + Partials     1753     1750        -3     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `?` | |
   | postgres | `?` | |
   | presto | `53.59% <63.75%> (+0.03%)` | :arrow_up: |
   | python | `58.02% <65.62%> (-24.76%)` | :arrow_down: |
   | sqlite | `?` | |
   | unit | `50.58% <60.62%> (+0.42%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/20465?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ui-core/src/chart/components/FallbackComponent.tsx](https://codecov.io/gh/apache/superset/pull/20465/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvY2hhcnQvY29tcG9uZW50cy9GYWxsYmFja0NvbXBvbmVudC50c3g=) | `100.00% <ø> (ø)` | |
   | [...packages/superset-ui-core/src/query/types/Query.ts](https://codecov.io/gh/apache/superset/pull/20465/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvdHlwZXMvUXVlcnkudHM=) | `100.00% <ø> (ø)` | |
   | [.../plugins/plugin-chart-echarts/src/BoxPlot/types.ts](https://codecov.io/gh/apache/superset/pull/20465/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9wbHVnaW4tY2hhcnQtZWNoYXJ0cy9zcmMvQm94UGxvdC90eXBlcy50cw==) | `0.00% <ø> (ø)` | |
   | [.../plugin-chart-echarts/src/Funnel/transformProps.ts](https://codecov.io/gh/apache/superset/pull/20465/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9wbHVnaW4tY2hhcnQtZWNoYXJ0cy9zcmMvRnVubmVsL3RyYW5zZm9ybVByb3BzLnRz) | `71.73% <ø> (ø)` | |
   | [...d/plugins/plugin-chart-echarts/src/Funnel/types.ts](https://codecov.io/gh/apache/superset/pull/20465/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9wbHVnaW4tY2hhcnQtZWNoYXJ0cy9zcmMvRnVubmVsL3R5cGVzLnRz) | `100.00% <ø> (ø)` | |
   | [...nd/plugins/plugin-chart-echarts/src/Gauge/types.ts](https://codecov.io/gh/apache/superset/pull/20465/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9wbHVnaW4tY2hhcnQtZWNoYXJ0cy9zcmMvR2F1Z2UvdHlwZXMudHM=) | `100.00% <ø> (ø)` | |
   | [...nd/plugins/plugin-chart-echarts/src/Graph/types.ts](https://codecov.io/gh/apache/superset/pull/20465/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9wbHVnaW4tY2hhcnQtZWNoYXJ0cy9zcmMvR3JhcGgvdHlwZXMudHM=) | `100.00% <ø> (ø)` | |
   | [...chart-echarts/src/MixedTimeseries/controlPanel.tsx](https://codecov.io/gh/apache/superset/pull/20465/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9wbHVnaW4tY2hhcnQtZWNoYXJ0cy9zcmMvTWl4ZWRUaW1lc2VyaWVzL2NvbnRyb2xQYW5lbC50c3g=) | `65.00% <ø> (ø)` | |
   | [.../plugin-chart-echarts/src/MixedTimeseries/types.ts](https://codecov.io/gh/apache/superset/pull/20465/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9wbHVnaW4tY2hhcnQtZWNoYXJ0cy9zcmMvTWl4ZWRUaW1lc2VyaWVzL3R5cGVzLnRz) | `100.00% <ø> (ø)` | |
   | [...ins/plugin-chart-echarts/src/Pie/transformProps.ts](https://codecov.io/gh/apache/superset/pull/20465/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9wbHVnaW4tY2hhcnQtZWNoYXJ0cy9zcmMvUGllL3RyYW5zZm9ybVByb3BzLnRz) | `55.07% <ø> (ø)` | |
   | ... and [365 more](https://codecov.io/gh/apache/superset/pull/20465/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/20465?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/20465?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 [467d8ef...199f233](https://codecov.io/gh/apache/superset/pull/20465?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