Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: migrate table chart to new API #10270

Merged
merged 6 commits into from
Jan 29, 2021

Conversation

ktmud
Copy link
Member

@ktmud ktmud commented Jul 9, 2020

SUMMARY

Move the table viz to API v1. Depends on apache-superset/superset-ui#889

Also did a bunch of refactoring on QueryContext and QueryObject:

  1. Rename DbColumnTypes to GenericDataType
  2. Add colnames and coltypes to query response. Didn't call them column_names to make it easier to search in the code.
  3. Support DTTM_ALIAS in groupby/columns
  4. Add a query context validation function, which runs more advanced validation on query context parameters before running the query. Currently only checks for duplicate column labels.
  5. Update post_processing.contribution to support applying contribution only on selected columns (needed for percent metrics).

Bumped superset-ui packages and plugins to 0.17.0:
apache-superset/superset-ui@v0.16.9...v0.17.0

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TEST PLAN

CI and manual verification.

  • Make sure major charts don't break.
  • Remember to test other charts that uses API v1, including word cloud, echarts, etc.

ADDITIONAL INFORMATION

@villebro
Copy link
Member

@ktmud this needs a rebase, will be happy to give it a spin once the conflicts are resolved

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment on adding the new results to the response schema. Looks great, let's get this in as soon as superset-ui/core is bumped to 0.15.

superset/connectors/sqla/models.py Outdated Show resolved Hide resolved
superset/db_engine_specs/base.py Outdated Show resolved Hide resolved
superset/utils/core.py Outdated Show resolved Hide resolved
superset/common/query_context.py Outdated Show resolved Hide resolved
@stale
Copy link

stale bot commented Nov 26, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

@stale stale bot added the inactive Inactive for >= 30 days label Nov 26, 2020
@stale stale bot removed the inactive Inactive for >= 30 days label Nov 27, 2020
@codecov-io
Copy link

codecov-io commented Dec 10, 2020

Codecov Report

Merging #10270 (5cfab09) into master (bab86ab) will increase coverage by 1.95%.
The diff coverage is 84.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10270      +/-   ##
==========================================
+ Coverage   64.99%   66.94%   +1.95%     
==========================================
  Files        1021     1021              
  Lines       50095    50125      +30     
  Branches     5141     5141              
==========================================
+ Hits        32559    33556     +997     
+ Misses      17360    16435     -925     
+ Partials      176      134      -42     
Flag Coverage Δ
cypress 50.87% <ø> (+13.23%) ⬆️
javascript 62.00% <ø> (ø)
python 63.87% <84.28%> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/charts/api.py 82.49% <66.66%> (-0.20%) ⬇️
superset/common/query_object.py 89.78% <71.42%> (-2.09%) ⬇️
superset/models/core.py 87.77% <75.00%> (-0.82%) ⬇️
superset/common/query_context.py 82.14% <77.77%> (-0.45%) ⬇️
superset/utils/core.py 88.04% <90.00%> (-0.01%) ⬇️
superset/connectors/sqla/models.py 90.58% <100.00%> (ø)
superset/db_engine_specs/base.py 85.45% <100.00%> (-0.52%) ⬇️
superset/utils/pandas_postprocessing.py 79.11% <100.00%> (+0.51%) ⬆️
superset/sql_validators/postgres.py 50.00% <0.00%> (-50.00%) ⬇️
superset/databases/commands/create.py 83.67% <0.00%> (-8.17%) ⬇️
... and 109 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bab86ab...5cfab09. Read the comment docs.

@villebro
Copy link
Member

@ktmud if you're busy I can help finish this

@ktmud
Copy link
Member Author

ktmud commented Dec 21, 2020

@villebro I'll finish it this week.

@ktmud ktmud force-pushed the table-chart-new-api branch 3 times, most recently from 7be3fd5 to 4fcf60e Compare January 7, 2021 21:33
@ktmud ktmud changed the title [WIP] refactor: migrate table chart to new API refactor: migrate table chart to new API Jan 7, 2021
@ktmud ktmud force-pushed the table-chart-new-api branch 3 times, most recently from f46ee03 to 5ee9045 Compare January 14, 2021 21:51
@ktmud ktmud marked this pull request as ready for review January 14, 2021 22:01
message=_("Request is incorrect: %(error)s", error=error.messages)
message=_(
"Request is incorrect: %(error)s", error=error.normalized_messages()
)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use normalized_messsages from mashmallow's ValidationError so that the error message shows which query field failed the validation.

@ktmud ktmud force-pushed the table-chart-new-api branch 3 times, most recently from 46cb0cb to 9b05065 Compare January 26, 2021 10:39
@ktmud
Copy link
Member Author

ktmud commented Jan 26, 2021

HOLD: Sort by isn't working for aggregation mode.

We may need another update on superset-ui.

(Thanks for the Cypress tests!)

@ktmud ktmud added the hold! On hold label Jan 27, 2021
@ktmud
Copy link
Member Author

ktmud commented Jan 27, 2021

@villebro @zhaoyongjie An update on this. I didn't have time to fix this today but will try to do it tomorrow. This PR should block bumping superset-ui packages since apache-superset/superset-ui#889 has been published.

@ktmud
Copy link
Member Author

ktmud commented Jan 29, 2021

@kristw @villebro could you help taking a look at apache-superset/superset-ui#919 , which should fix the failing E2E test in this PR.

@villebro
Copy link
Member

could you help taking a look at apache-superset/superset-ui#919 , which should fix the failing E2E test in this PR.

Approved - I'll merge it and deploy in an hour or so if you're offline (hmm, it seems to be stuck, I'll kick CI if it doesn't wake up soon)

@ktmud
Copy link
Member Author

ktmud commented Jan 29, 2021

@villebro I've done the bumping. Feel free to merge when the CI is green.

@villebro
Copy link
Member

That would be right now 🙂

@villebro villebro merged commit e3db935 into apache:master Jan 29, 2021
@rusackas rusackas removed the hold! On hold label Feb 2, 2021
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.2.0 labels Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/XL 🚢 1.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants