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

feat(sqllab): Add /sqllab endpoint to the v1 api #24983

Merged
merged 10 commits into from
Aug 16, 2023

Conversation

justinpark
Copy link
Member

@justinpark justinpark commented Aug 14, 2023

SUMMARY

Part 1-b of SQLLab SPA migration: detail link

This commit introduces new api endpoint (/api/v1/sqllab/) and re-use the sqllab_bootstrap_data util to share the bootstrap data with the legacy landing page.

We will migrate the legacy bootstrap util by a command class after the SPA initiative is completed.

GET /v1/sqllab/

RESPONSE
{
  active_tab: <object>
  databases: <array of database object>
  queries: <hashmap of query object>
  tab_state_ids: <list of a tab id and name>
}

Screenshot 2023-08-14 at 2 08 25 PM

TESTING INSTRUCTIONS

1 - Execute the API tests
2 - All tests should pass

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

@EugeneTorap
Copy link
Contributor

Thanks! Can you try to fix the tests?

{"SQLLAB_BACKEND_PERSISTENCE": False},
clear=True,
)
def test_get_from_bootstrap_data(self):
Copy link
Member

Choose a reason for hiding this comment

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

Is this trying to test a scenario where there's no data available? If so, could you improve the test name to something like test_empty_bootstrap_data?

{"SQLLAB_BACKEND_PERSISTENCE": True},
clear=True,
)
def test_get_from_backend_persistence_payload(self):
Copy link
Member

Choose a reason for hiding this comment

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

Maybe rename to test_bootstrap_data_queries?

@@ -37,11 +37,76 @@
from superset.models.sql_lab import Query

from tests.integration_tests.base_tests import SupersetTestCase
from tests.integration_tests.fixtures.users import create_gamma_sqllab_no_data

QUERIES_FIXTURE_COUNT = 10


class TestSqlLabApi(SupersetTestCase):
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a test for forbidden access?

{"result": result},
default=utils.json_iso_dttm_ser,
ignore_nan=True,
encoding=None,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
encoding=None,

get:
summary: Get the bootstrap data for SqlLab page
description: >-
Assembles SQLLab bootstrap data(active_tab, databases, queries, tab_state_ids
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Assembles SQLLab bootstrap data(active_tab, databases, queries, tab_state_ids
Assembles SQLLab bootstrap data (active_tab, databases, queries, tab_state_ids

Copy link
Member

@michael-s-molina michael-s-molina left a comment

Choose a reason for hiding this comment

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

LGTM

@justinpark justinpark merged commit 10abb68 into apache:master Aug 16, 2023
29 checks passed
@justinpark justinpark deleted the feat--sqllab-v1-endpoint branch August 16, 2023 23:11
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.1.0 labels Mar 8, 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/L 🚢 3.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants