You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2022/08/30 12:41:39 UTC

[superset] 01/13: fix: sqloxide optional (#19570)

This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch 1.5
in repository https://gitbox.apache.org/repos/asf/superset.git

commit af5ded3fcbaf964fcf7d6c56be2fc26540987fcd
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Wed Apr 6 16:11:38 2022 -0700

    fix: sqloxide optional (#19570)
---
 UPDATING.md                         |  7 +++++++
 requirements/testing.in             |  1 +
 requirements/testing.txt            | 13 +++++--------
 setup.py                            |  1 -
 superset/migrations/shared/utils.py | 10 +++++++++-
 5 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/UPDATING.md b/UPDATING.md
index 0923865c62..24d03c4a21 100644
--- a/UPDATING.md
+++ b/UPDATING.md
@@ -22,6 +22,12 @@ under the License.
 This file documents any backwards-incompatible changes in Superset and
 assists people when migrating to a new version.
 
+## 1.5.2
+
+### Other
+
+- [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.
+
 ## 1.5.0
 
 ### Breaking Changes
@@ -54,6 +60,7 @@ assists people when migrating to a new version.
 ## 1.4.1
 
 ### Breaking Changes
+
 - [17984](https://github.com/apache/superset/pull/17984): Default Flask SECRET_KEY has changed for security reasons. You should always override with your own secret. Set `PREVIOUS_SECRET_KEY` (ex: PREVIOUS_SECRET_KEY = "\2\1thisismyscretkey\1\2\\e\\y\\y\\h") with your previous key and use `superset re-encrypt-secrets` to rotate you current secrets
 
 ### Potential Downtime
diff --git a/requirements/testing.in b/requirements/testing.in
index c33f245280..082dbc934a 100644
--- a/requirements/testing.in
+++ b/requirements/testing.in
@@ -36,6 +36,7 @@ pytest
 pytest-cov
 statsd
 pytest-mock
+sqloxide
 # DB dependencies
 -e file:.[bigquery]
 -e file:.[trino]
diff --git a/requirements/testing.txt b/requirements/testing.txt
index a02d250526..ec61b36757 100644
--- a/requirements/testing.txt
+++ b/requirements/testing.txt
@@ -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
@@ -138,9 +135,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
@@ -168,6 +163,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
diff --git a/setup.py b/setup.py
index 02b3924c72..7af8fe619a 100644
--- a/setup.py
+++ b/setup.py
@@ -112,7 +112,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)
diff --git a/superset/migrations/shared/utils.py b/superset/migrations/shared/utils.py
index bff25e05d1..c54de83c42 100644
--- a/superset/migrations/shared/utils.py
+++ b/superset/migrations/shared/utils.py
@@ -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: