-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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: add Postgres SQL validator #11538
Conversation
8ba4851
to
adeb231
Compare
adeb231
to
05dbeb9
Compare
Codecov Report
@@ Coverage Diff @@
## master #11538 +/- ##
==========================================
- Coverage 66.62% 60.96% -5.66%
==========================================
Files 873 888 +15
Lines 41870 43324 +1454
Branches 3847 3817 -30
==========================================
- Hits 27894 26412 -1482
- Misses 13875 16912 +3037
+ Partials 101 0 -101
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love it! LGTM, but bonus points for a test if it's not too much trouble.
name = "PostgreSQLValidator" | ||
|
||
@classmethod | ||
def validate( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add unit tests
SUMMARY
This PR adds a SQL validator for Postgres queries in SQL Lab. It uses the pgsanity module, which parses the query, providing syntax validation without having to talk to the database.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TEST PLAN
Create a
superset_config.py
:And tested a few queries.
ADDITIONAL INFORMATION