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

fix: sqloxide optional #19570

Merged
merged 1 commit into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ assists people when migrating to a new version.

- [19046](https://github.com/apache/superset/pull/19046): Enables the drag and drop interface in Explore control panel by default. Flips `ENABLE_EXPLORE_DRAG_AND_DROP` and `ENABLE_DND_WITH_CLICK_UX` feature flags to `True`.
- [18936](https://github.com/apache/superset/pull/18936): Removes legacy SIP-15 interm logic/flags—specifically the `SIP_15_ENABLED`, `SIP_15_GRACE_PERIOD_END`, `SIP_15_DEFAULT_TIME_RANGE_ENDPOINTS`, and `SIP_15_TOAST_MESSAGE` flags. Time range endpoints are no longer configurable and strictly adhere to the `[start, end)` paradigm, i.e., inclusive of the start and exclusive of the end. Additionally this change removes the now obsolete `time_range_endpoints` from the form-data and resulting in the cache being busted.
- [19570](https://github.com/apache/superset/pull/19570): makes [sqloxide](https://pypi.org/project/sqloxide/) optional so the SIP-68 migration can be run on aarch64. If the migration is taking too long installing sqloxide manually should improve the performance.

### Breaking Changes

Expand Down
1 change: 1 addition & 0 deletions requirements/testing.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pytest
pytest-cov
statsd
pytest-mock
sqloxide
# DB dependencies
-e file:.[bigquery]
-e file:.[trino]
13 changes: 5 additions & 8 deletions requirements/testing.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SHA1:7a8e256097b4758bdeda2529d3d4d31e421e1a3c
# SHA1:e273e8da6bfd5f6f8563fe067e243297cc7c588c
#
# This file is autogenerated by pip-compile-multi
# To update, run:
Expand Down Expand Up @@ -52,7 +52,6 @@ google-auth-oauthlib==0.4.6
google-cloud-bigquery[bqstorage,pandas]==2.29.0
# via
# -r requirements/testing.in
# apache-superset
# pandas-gbq
# pybigquery
google-cloud-bigquery-storage==2.9.1
Expand Down Expand Up @@ -105,9 +104,7 @@ openapi-schema-validator==0.1.5
openapi-spec-validator==0.3.1
# via -r requirements/testing.in
pandas-gbq==0.15.0
# via
# -r requirements/testing.in
# apache-superset
# via -r requirements/testing.in
parameterized==0.8.1
# via -r requirements/testing.in
parso==0.8.2
Expand Down Expand Up @@ -136,9 +133,7 @@ pyasn1==0.4.8
pyasn1-modules==0.2.8
# via google-auth
pybigquery==0.10.2
# via
# -r requirements/testing.in
# apache-superset
# via -r requirements/testing.in
pydata-google-auth==1.2.0
# via pandas-gbq
pyfakefs==4.5.0
Expand Down Expand Up @@ -166,6 +161,8 @@ rsa==4.7.2
# via google-auth
sqlalchemy-trino==0.4.1
# via apache-superset
sqloxide==0.1.15
# via -r requirements/testing.in
statsd==3.3.0
# via -r requirements/testing.in
traitlets==5.0.5
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ def get_git_sha() -> str:
"slackclient==2.5.0", # PINNED! slack changes file upload api in the future versions
"sqlalchemy>=1.3.16, <1.4, !=1.3.21",
"sqlalchemy-utils>=0.37.8, <0.38",
"sqloxide==0.1.15",
"sqlparse==0.3.0", # PINNED! see https://github.com/andialbrecht/sqlparse/issues/562
"tabulate==0.8.9",
# needed to support Literal (3.8) and TypeGuard (3.10)
Expand Down
10 changes: 9 additions & 1 deletion superset/migrations/shared/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
from sqlalchemy import engine_from_config
from sqlalchemy.engine import reflection
from sqlalchemy.exc import NoSuchTableError
from sqloxide import parse_sql

try:
from sqloxide import parse_sql
except ImportError:
parse_sql = None

from superset.sql_parse import ParsedQuery, Table

Expand Down Expand Up @@ -88,6 +92,10 @@ def extract_table_references(sql_text: str, sqla_dialect: str) -> Set[Table]:
"""
Return all the dependencies from a SQL sql_text.
"""
if not parse_sql:
parsed = ParsedQuery(sql_text)
return parsed.tables

dialect = "generic"
for dialect, sqla_dialects in sqloxide_dialects.items():
if sqla_dialect in sqla_dialects:
Expand Down