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: Live query validation in the SQL Lab UI #7461

Merged

Conversation

bearcage
Copy link
Contributor

@bearcage bearcage commented May 6, 2019

CATEGORY

Choose one

  • Bug Fix
  • Enhancement (new features, refinement)
  • Refactor
  • Add tests
  • Build / Development Environment
  • Documentation

SUMMARY

This builds on #7422 to build check-as-you-type sql query validation in Sql Lab. This closes #6707 too.

This adds a (debounced) call to the validate_sql_json API endpoint with the querytext. If no validator is configured for the selected database, per the feature flag from #7422, no validation requests will be sent from the UI. On Lyft's infra the presto validator is able to return feedback to the user (end to end) in about 2 seconds.

At present feedback is provided only through the "annotations" mechanism build in to ACE, although I'd be open to adding full text elsewhere on the page if there's interest.

This diff does not include new cypress tests covering this interaction.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

validation-med

Server error reporting:
Screen Shot 2019-05-05 at 7 19 38 PM

Query error reporting:
Screen Shot 2019-05-05 at 7 21 08 PM

TEST PLAN

  1. Start a development instance
  2. Follow the instructions in INSTALLING to enable the presto validator
  3. Connect to a prestodb instance
  4. Try writing some queries against it!

You can verify the unhappy paths by:

  • Injecting 5xx into your communications with presto
  • Using a database which does not support validation (like the built-in sqlite). Note that no validation attempts will even be made in this case.

ADDITIONAL INFORMATION

REVIEWERS

@xtinec @DiggidyDave @khtruong @betodealmeida

This builds on apache#7422 to build check-as-you-type sql
query validation in Sql Lab. This closes apache#6707 too.

It adds a (debounced) call to the validate_sql_json
API endpoint with the querytext, and on Lyft infra is
able to return feedback to the user (end to end) in
$TBD seconds.

At present feedback is provided only through the
"annotations" mechanism build in to ACE, although
I'd be open to adding full text elsewhere on the
page if there's interest.
@khtruong
Copy link
Contributor

khtruong commented May 6, 2019

Adding @kristw and @williaster for :eyes

superset/assets/src/SqlLab/actions/sqlLab.js Outdated Show resolved Hide resolved
superset/assets/src/SqlLab/actions/sqlLab.js Outdated Show resolved Hide resolved
@@ -126,6 +133,11 @@ class SqlEditor extends React.PureComponent {
}
onSqlChanged(sql) {
this.setState({ sql });
// Request server-side validation of the query text
if (this.canValidateQuery()) {
// NB. requestValidation is debounced
Copy link
Contributor

Choose a reason for hiding this comment

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

What is NB?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I never realized that was weird, but I guess it is a bit now that I think about it!

NB means "nota bene", latin for "note well" — I usually use it in comments where "NOTE:" would also work

@bearcage bearcage changed the title [WIP] Live query validation, where supported feat: Live query validation in the SQL Lab UI May 6, 2019
@xtinec xtinec merged commit ae409d6 into apache:lyft-release-sp8 May 6, 2019
bearcage pushed a commit to bearcage/incubator-superset that referenced this pull request May 15, 2019
* [WIP] Live query validation, where supported

This builds on apache#7422 to build check-as-you-type sql
query validation in Sql Lab. This closes apache#6707 too.

It adds a (debounced) call to the validate_sql_json
API endpoint with the querytext, and on Lyft infra is
able to return feedback to the user (end to end) in
$TBD seconds.

At present feedback is provided only through the
"annotations" mechanism build in to ACE, although
I'd be open to adding full text elsewhere on the
page if there's interest.

* fix: Unbreak lints and tests
xtinec pushed a commit that referenced this pull request May 15, 2019
* [WIP] Live query validation, where supported

This builds on #7422 to build check-as-you-type sql
query validation in Sql Lab. This closes #6707 too.

It adds a (debounced) call to the validate_sql_json
API endpoint with the querytext, and on Lyft infra is
able to return feedback to the user (end to end) in
$TBD seconds.

At present feedback is provided only through the
"annotations" mechanism build in to ACE, although
I'd be open to adding full text elsewhere on the
page if there's interest.

* fix: Unbreak lints and tests
bearcage pushed a commit to bearcage/incubator-superset that referenced this pull request May 15, 2019
)

* [WIP] Live query validation, where supported

This builds on apache#7422 to build check-as-you-type sql
query validation in Sql Lab. This closes apache#6707 too.

It adds a (debounced) call to the validate_sql_json
API endpoint with the querytext, and on Lyft infra is
able to return feedback to the user (end to end) in
$TBD seconds.

At present feedback is provided only through the
"annotations" mechanism build in to ACE, although
I'd be open to adding full text elsewhere on the
page if there's interest.

* fix: Unbreak lints and tests
xtinec pushed a commit that referenced this pull request May 15, 2019
* [WIP] Live query validation, where supported

This builds on #7422 to build check-as-you-type sql
query validation in Sql Lab. This closes #6707 too.

It adds a (debounced) call to the validate_sql_json
API endpoint with the querytext, and on Lyft infra is
able to return feedback to the user (end to end) in
$TBD seconds.

At present feedback is provided only through the
"annotations" mechanism build in to ACE, although
I'd be open to adding full text elsewhere on the
page if there's interest.

* fix: Unbreak lints and tests
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.34.0 labels Feb 28, 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 🚢 0.34.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants