-
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
chore: organize SQL parsing files #30258
Conversation
63813b1
to
163feb4
Compare
163feb4
to
58384de
Compare
@@ -63,7 +63,8 @@ | |||
from superset.databases.utils import get_table_metadata, make_url_safe | |||
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType | |||
from superset.exceptions import DisallowedSQLFunction, OAuth2Error, OAuth2RedirectError | |||
from superset.sql_parse import ParsedQuery, SQLScript, Table | |||
from superset.sql.parse import SQLScript, Table | |||
from superset.sql_parse import ParsedQuery |
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.
nit, but these two paths are really similar. What's the difference between them and will people be able to remember what goes where?
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.
Oh, sorry, I forgot to mention that the goal is to get rid of sql_parse.py
.
The new superset/sql/
directory will use only sqlglot
, and as I'm working on SIP-117 I'm taking sqlparse
logic from sql_parse.py
and reimplementing it using sqlglot
in sql/parse/
.
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.
ok, perfect, that makes sense, then.
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.
LGTM!
(cherry picked from commit bdf29cb)
SUMMARY
Move the
SQLScript
,SQLStatement
, and related functions that usesqlglot
to a new directorysuperset/sql/
, since thesuperset/sql_parse.py
file is getting big. This was suggested by @mistercrunch on the discussion about SIP-117.The goal with SIP-117 is to have all SQL parsing living in
superset/sql/
and usingsqlglot
, and get rid ofsql_parse.py
.I also split the unit tests from
tests/unit_tests/sql_parse_tests.py
totests/unit_tests/sql/parse_tests.py
, and in the process I converted some of the oldParsedQuery.tables
tests to the newextract_tables_from_statement
function.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION