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

chore: Migrate SqlLab API to API v1 #22661

Closed
wants to merge 3 commits into from
Closed

chore: Migrate SqlLab API to API v1 #22661

wants to merge 3 commits into from

Conversation

EugeneTorap
Copy link
Contributor

SUMMARY

Created api/v1/sqllab/API for future SPA migration of SQL Lab
Migrated superset/sql_json/ to /api/v1/sqllab/execute/sql/

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

@codecov
Copy link

codecov bot commented Jan 10, 2023

Codecov Report

Merging #22661 (8bd0389) into master (3ffdad1) will decrease coverage by 10.99%.
The diff coverage is 82.20%.

@@             Coverage Diff             @@
##           master   #22661       +/-   ##
===========================================
- Coverage   67.00%   56.00%   -11.00%     
===========================================
  Files        1859     1868        +9     
  Lines       71103    71422      +319     
  Branches     7782     7782               
===========================================
- Hits        47643    40002     -7641     
- Misses      21434    29394     +7960     
  Partials     2026     2026               
Flag Coverage Δ
hive 52.68% <82.20%> (+0.12%) ⬆️
mysql ?
postgres ?
presto 52.58% <82.20%> (+0.12%) ⬆️
python 58.31% <82.20%> (-22.99%) ⬇️
sqlite ?
unit 51.55% <59.32%> (+0.12%) ⬆️

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

Impacted Files Coverage Δ
superset-frontend/src/SqlLab/actions/sqlLab.js 63.56% <ø> (ø)
superset/sqllab/api.py 74.35% <74.35%> (ø)
superset/views/sql_lab/views.py 58.38% <90.90%> (-5.44%) ⬇️
superset/initialization/__init__.py 91.88% <100.00%> (+0.13%) ⬆️
superset/sqllab/tabs.py 100.00% <100.00%> (ø)
superset/views/core.py 35.09% <100.00%> (-39.95%) ⬇️
superset/utils/dashboard_import_export.py 0.00% <0.00%> (-100.00%) ⬇️
superset/tags/core.py 4.54% <0.00%> (-95.46%) ⬇️
superset/key_value/commands/update.py 0.00% <0.00%> (-90.91%) ⬇️
superset/key_value/commands/delete.py 0.00% <0.00%> (-87.88%) ⬇️
... and 300 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

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.

Great initiative! Left some comments - especially the OpenAPI schemas are needed. Also, we should replace the old integration tests with new ones that cover the main use cases.

queries: Dict[str, Any] = {}

# These are unnecessary if sqllab backend persistence is disabled
if is_feature_enabled("SQLLAB_BACKEND_PERSISTENCE"):
Copy link
Member

Choose a reason for hiding this comment

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

As SQLLAB_BACKEND_PERSISTENCE has been enabled for quite some time by default, I wonder if we should just remove the FF and clean up these conditionalities. Thoughts @dpgaspar @betodealmeida ?

Comment on lines +69 to +72
def get(self) -> Response:
"""Assembles SqlLab related information (defaultDbId, tab_state_ids, active_tab)
in a single endpoint.
"""
Copy link
Member

Choose a reason for hiding this comment

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

We need to add the schema spec here, otherwise we won't get an API spec:
image

@rusackas rusackas requested a review from hughhhh January 13, 2023 16:41
@EugeneTorap
Copy link
Contributor Author

Superseded by #22809, closing

@EugeneTorap EugeneTorap deleted the feat/sqllab-api branch January 23, 2023 15:36
@trhagado
Copy link

I'm trying to use the SqlLab API that has recently been migrated to api/v1/sqllab and am having some difficulties. I can get the api/v1/sqllab/execute endpoint to work fine but don't seem to be able to successfully do an async execute followed by a api/v1/sqllab/results call to get the resulting data rows of the execute. Also I'd like to get the rows in chunks instead of all at once but am unsure if this is supported. Example Python code of an async execute followed by one or more results calls would be very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants