fix: sqloxide optional (#19570)

This commit is contained in:
Beto Dealmeida 2022-04-06 16:11:38 -07:00 committed by GitHub
parent 444b4f5832
commit 6136942759
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 10 deletions

View File

@ -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

View File

@ -36,6 +36,7 @@ pytest
pytest-cov
statsd
pytest-mock
sqloxide
# DB dependencies
-e file:.[bigquery]
-e file:.[trino]

View File

@ -1,4 +1,4 @@
# SHA1:7a8e256097b4758bdeda2529d3d4d31e421e1a3c
# SHA1:e273e8da6bfd5f6f8563fe067e243297cc7c588c
#
# This file is autogenerated by pip-compile-multi
# To update, run:
@ -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
@ -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
@ -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
@ -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

View File

@ -111,7 +111,6 @@ setup(
"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)

View File

@ -21,7 +21,11 @@ from alembic import op
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
@ -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: