-
Notifications
You must be signed in to change notification settings - Fork 15.1k
chore: remove sqlparse #33564
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
base: master
Are you sure you want to change the base?
chore: remove sqlparse #33564
Conversation
Based on your review schedule, I'll hold off on reviewing this PR until it's marked as ready for review. If you'd like me to take a look now, comment
|
c26a781
to
6f80142
Compare
7d53164
to
0ff7dc3
Compare
c315f16
to
4bc09be
Compare
if not cls.allows_sql_comments: | ||
query = sql_parse.strip_comments_from_sql(query, engine=cls.engine) | ||
disallowed_functions = current_app.config["DISALLOWED_SQL_FUNCTIONS"].get( | ||
cls.engine, set() | ||
) | ||
if sql_parse.check_sql_functions_exist(query, disallowed_functions, cls.engine): | ||
raise DisallowedSQLFunction(disallowed_functions) | ||
|
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 moved this logic to the caller, to prevent DB engine specs from defining their own execute
methods that skip this validation.
b123b54
to
094e4b9
Compare
@@ -93,21 +92,3 @@ def test_opendistro_sqla_column_label(original: str, expected: str) -> None: | |||
from superset.db_engine_specs.elasticsearch import OpenDistroEngineSpec | |||
|
|||
assert OpenDistroEngineSpec.make_label_compatible(original) == expected | |||
|
|||
|
|||
def test_opendistro_strip_comments() -> None: |
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.
This is no longer responsibility of the DB engine spec.
@@ -1950,15 +1946,6 @@ def get_sqla_query( # pylint: disable=too-many-arguments,too-many-locals,too-ma | |||
if extras: | |||
where = extras.get("where") | |||
if where: | |||
try: |
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.
Moved this to the query object, since we need it for sanitize_clause
.
094e4b9
to
eefc631
Compare
superset/utils/rls.py
Outdated
from superset.sql.parse import Table | ||
|
||
|
||
def get_predicates_for_table( |
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.
wondering if in some cases the caller already has a handle on the table / database object and could save a db roundtrip (?) Maybe we need a command / DAO for this?
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.
Here we're always coming from a query, so there are no dataset handles — in fact, a query could have multiple tables, so we'd need dataset handles for all of them.
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, make sense, so potentially multiple round trips, one for each table ... probably fine as I'm guessing it was this way before.
9a3a034
to
acd467b
Compare
2788837
to
2ca634b
Compare
2ca634b
to
4834814
Compare
SUMMARY
Part of SIP-117, stacked on:
Remove
sqlparse
from Superset.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION