Skip to content

refactor: migrate table chart to new API - #10270

Merged
villebro merged 6 commits into
apache:masterfrom
ktmud:table-chart-new-api
Jan 29, 2021
Merged

refactor: migrate table chart to new API#10270
villebro merged 6 commits into
apache:masterfrom
ktmud:table-chart-new-api

Conversation

@ktmud

@ktmud ktmud commented Jul 9, 2020

Copy link
Copy Markdown
Member

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

@ktmud
ktmud force-pushed the table-chart-new-api branch from afc2b4a to 0273508 Compare July 9, 2020 16:29
@rusackas
rusackas requested a review from villebro July 23, 2020 17:45
@villebro

Copy link
Copy Markdown
Member

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

@villebro villebro left a comment

Copy link
Copy Markdown
Member

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.

Comment thread superset/connectors/sqla/models.py Outdated
Comment thread superset/db_engine_specs/base.py Outdated
Comment thread superset/utils/core.py Outdated
Comment thread superset/common/query_context.py Outdated
@ktmud
ktmud force-pushed the table-chart-new-api branch from 0273508 to 602dce7 Compare September 14, 2020 04:31
@stale

stale Bot commented Nov 26, 2020

Copy link
Copy Markdown

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
@ktmud
ktmud force-pushed the table-chart-new-api branch from 602dce7 to a1e87a8 Compare November 27, 2020 05:01
@stale stale Bot removed the inactive Inactive for >= 30 days label Nov 27, 2020
@ktmud
ktmud force-pushed the table-chart-new-api branch from a1e87a8 to 295c88d Compare December 10, 2020 21:57
@codecov-io

codecov-io commented Dec 10, 2020

Copy link
Copy Markdown

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
Copy Markdown
Member

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

@ktmud

ktmud commented Dec 21, 2020

Copy link
Copy Markdown
Member Author

@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 from 1129349 to a0fdb6e Compare January 8, 2021 00:10
@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
Comment thread superset/charts/api.py Outdated

Copy link
Copy Markdown
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 from 8e2dc63 to 210ae65 Compare January 15, 2021 01:03
@ktmud
ktmud force-pushed the table-chart-new-api branch 2 times, most recently from 84d92b3 to 8263bf7 Compare January 15, 2021 21:10
@ktmud
ktmud force-pushed the table-chart-new-api branch 2 times, most recently from 46cb0cb to 9b05065 Compare January 26, 2021 10:39
@ktmud
ktmud force-pushed the table-chart-new-api branch from 588ceee to 026c639 Compare January 26, 2021 17:57
@ktmud

ktmud commented Jan 26, 2021

Copy link
Copy Markdown
Member Author

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

ktmud commented Jan 27, 2021

Copy link
Copy Markdown
Member Author

@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

ktmud commented Jan 29, 2021

Copy link
Copy Markdown
Member Author

@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
Copy Markdown
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
ktmud force-pushed the table-chart-new-api branch from ef12444 to 5cfab09 Compare January 29, 2021 10:17
@ktmud

ktmud commented Jan 29, 2021

Copy link
Copy Markdown
Member Author

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

@villebro

Copy link
Copy Markdown
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 First shipped in 1.2.0 labels Feb 19, 2024
qfcwell pushed a commit to qfcwell/superset that referenced this pull request May 12, 2026
* refactor: migrate table chart to new API

* chore: bump superset-ui to 0.17.0

* Fix Cypress tests

* Apply soft-conversion to numeric metrics

Fix time column formatting test

* Add translation to chart does not exist error

* Bump to 0.17.1
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 First shipped in 1.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants