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 2024/02/23 15:10:36 UTC

(superset) branch 3.1 updated (8706879755 -> e21179fa11)

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

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


    from 8706879755 fix: Failed to execute importScripts on worker-css (#27191)
     new ee7eec60ea fix: no limit in SELECT * for TOP dbs (#27215)
     new e21179fa11 fix: setting important lower bounds versions on requirements (#27167)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 requirements/base.in                          |  1 +
 requirements/base.txt                         |  7 ++-
 requirements/docker.in                        |  3 +-
 requirements/docker.txt                       |  4 +-
 requirements/testing.in                       |  1 +
 requirements/testing.txt                      |  3 +-
 setup.py                                      |  1 +
 superset/db_engine_specs/base.py              |  2 +-
 tests/unit_tests/db_engine_specs/test_base.py | 75 ++++++++++++++++++++++++++-
 9 files changed, 88 insertions(+), 9 deletions(-)


(superset) 01/02: fix: no limit in SELECT * for TOP dbs (#27215)

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit ee7eec60ea9854773400361088f5f792e7135664
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Thu Feb 22 17:01:29 2024 -0500

    fix: no limit in SELECT * for TOP dbs (#27215)
    
    (cherry picked from commit c54fbe6e969fe57cddc69759796e4df1f603430e)
---
 superset/db_engine_specs/base.py              |  2 +-
 tests/unit_tests/db_engine_specs/test_base.py | 75 ++++++++++++++++++++++++++-
 2 files changed, 75 insertions(+), 2 deletions(-)

diff --git a/superset/db_engine_specs/base.py b/superset/db_engine_specs/base.py
index 5edd4b7c06..66293ccf52 100644
--- a/superset/db_engine_specs/base.py
+++ b/superset/db_engine_specs/base.py
@@ -1441,7 +1441,7 @@ class BaseEngineSpec:  # pylint: disable=too-many-public-methods
 
         qry = select(fields).select_from(text(full_table_name))
 
-        if limit:
+        if limit and cls.allow_limit_clause:
             qry = qry.limit(limit)
         if latest_partition:
             partition_query = cls.where_latest_partition(
diff --git a/tests/unit_tests/db_engine_specs/test_base.py b/tests/unit_tests/db_engine_specs/test_base.py
index 7b1977ff14..e4cf4dfc1f 100644
--- a/tests/unit_tests/db_engine_specs/test_base.py
+++ b/tests/unit_tests/db_engine_specs/test_base.py
@@ -14,13 +14,16 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-# pylint: disable=unused-argument, import-outside-toplevel, protected-access
+# pylint: disable=import-outside-toplevel, protected-access
 
 from textwrap import dedent
 from typing import Any, Optional
 
 import pytest
+from pytest_mock import MockFixture
 from sqlalchemy import types
+from sqlalchemy.dialects import sqlite
+from sqlalchemy.sql import sqltypes
 
 from superset.superset_typing import ResultSetColumnType, SQLAColumnType
 from superset.utils.core import GenericDataType
@@ -168,3 +171,73 @@ def test_convert_inspector_columns(
     from superset.db_engine_specs.base import convert_inspector_columns
 
     assert convert_inspector_columns(cols) == expected_result
+
+
+def test_select_star(mocker: MockFixture) -> None:
+    """
+    Test the ``select_star`` method.
+    """
+    from superset.db_engine_specs.base import BaseEngineSpec
+
+    class NoLimitDBEngineSpec(BaseEngineSpec):
+        allow_limit_clause = False
+
+    cols: list[ResultSetColumnType] = [
+        {
+            "column_name": "a",
+            "name": "a",
+            "type": sqltypes.String(),
+            "nullable": True,
+            "comment": None,
+            "default": None,
+            "precision": None,
+            "scale": None,
+            "max_length": None,
+            "is_dttm": False,
+        },
+    ]
+
+    # mock the database so we can compile the query
+    database = mocker.MagicMock()
+    database.compile_sqla_query = lambda query: str(
+        query.compile(dialect=sqlite.dialect())
+    )
+
+    engine = mocker.MagicMock()
+    engine.dialect = sqlite.dialect()
+
+    sql = BaseEngineSpec.select_star(
+        database=database,
+        table_name="my_table",
+        engine=engine,
+        schema=None,
+        limit=100,
+        show_cols=True,
+        indent=True,
+        latest_partition=False,
+        cols=cols,
+    )
+    assert (
+        sql
+        == """SELECT a
+FROM my_table
+LIMIT ?
+OFFSET ?"""
+    )
+
+    sql = NoLimitDBEngineSpec.select_star(
+        database=database,
+        table_name="my_table",
+        engine=engine,
+        schema=None,
+        limit=100,
+        show_cols=True,
+        indent=True,
+        latest_partition=False,
+        cols=cols,
+    )
+    assert (
+        sql
+        == """SELECT a
+FROM my_table"""
+    )


(superset) 02/02: fix: setting important lower bounds versions on requirements (#27167)

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit e21179fa11835aaf3e68de1b91dc67cda301e2c1
Author: Daniel Vaz Gaspar <da...@gmail.com>
AuthorDate: Fri Feb 23 10:09:56 2024 +0000

    fix: setting important lower bounds versions on requirements (#27167)
---
 requirements/base.in     | 1 +
 requirements/base.txt    | 7 +++++--
 requirements/docker.in   | 3 +--
 requirements/docker.txt  | 4 ++--
 requirements/testing.in  | 1 +
 requirements/testing.txt | 3 ++-
 setup.py                 | 1 +
 7 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/requirements/base.in b/requirements/base.in
index 9d83138237..dc632a096a 100644
--- a/requirements/base.in
+++ b/requirements/base.in
@@ -17,3 +17,4 @@
 # under the License.
 #
 -e file:.
+urllib3>=1.26.18
diff --git a/requirements/base.txt b/requirements/base.txt
index c6c2c086da..8aa9eda96e 100644
--- a/requirements/base.txt
+++ b/requirements/base.txt
@@ -1,4 +1,4 @@
-# SHA1:a9dde048f1ee1f00586264d726d0e89f16e56183
+# SHA1:60b260247b40133819664dc998d9e2da48e9a592
 #
 # This file is autogenerated by pip-compile-multi
 # To update, run:
@@ -233,7 +233,9 @@ packaging==23.1
 pandas[performance]==2.0.3
     # via apache-superset
 paramiko==3.4.0
-    # via sshtunnel
+    # via
+    #   apache-superset
+    #   sshtunnel
 parsedatetime==2.6
     # via apache-superset
 pgsanity==0.2.9
@@ -351,6 +353,7 @@ url-normalize==1.4.3
     # via requests-cache
 urllib3==1.26.18
     # via
+    #   -r requirements/base.in
     #   requests
     #   requests-cache
     #   selenium
diff --git a/requirements/docker.in b/requirements/docker.in
index b7e893f3e9..5b65cc6871 100644
--- a/requirements/docker.in
+++ b/requirements/docker.in
@@ -15,6 +15,5 @@
 # limitations under the License.
 #
 -r base.in
--e .[postgres]
-gevent
+-e .[postgres,gevent]
 greenlet>=2.0.2
diff --git a/requirements/docker.txt b/requirements/docker.txt
index be65b7d36b..27c135e04c 100644
--- a/requirements/docker.txt
+++ b/requirements/docker.txt
@@ -1,4 +1,4 @@
-# SHA1:439e3ee196ce81f342c935117ba5e0eeee8c385b
+# SHA1:f00a57c70a52607d638c19f64f426f887382927e
 #
 # This file is autogenerated by pip-compile-multi
 # To update, run:
@@ -11,7 +11,7 @@
     #   -r requirements/base.in
     #   -r requirements/docker.in
 gevent==23.9.1
-    # via -r requirements/docker.in
+    # via apache-superset
 psycopg2-binary==2.9.6
     # via apache-superset
 zope-event==4.5.0
diff --git a/requirements/testing.in b/requirements/testing.in
index 5b498bb090..3245886ec8 100644
--- a/requirements/testing.in
+++ b/requirements/testing.in
@@ -20,6 +20,7 @@
 docker
 flask-testing
 freezegun
+grpcio>=1.55.3
 openapi-spec-validator
 parameterized
 pyfakefs
diff --git a/requirements/testing.txt b/requirements/testing.txt
index e7095b7f72..e044f3ffab 100644
--- a/requirements/testing.txt
+++ b/requirements/testing.txt
@@ -1,4 +1,4 @@
-# SHA1:95300275481abb1413eb98a5c79fb7cf96814cdd
+# SHA1:a37a1037f359c1101162ef43288178fbf00c487d
 #
 # This file is autogenerated by pip-compile-multi
 # To update, run:
@@ -70,6 +70,7 @@ googleapis-common-protos==1.59.0
     #   grpcio-status
 grpcio==1.60.1
     # via
+    #   -r requirements/testing.in
     #   google-api-core
     #   google-cloud-bigquery
     #   grpcio-status
diff --git a/setup.py b/setup.py
index 25c547f246..99e7499e68 100644
--- a/setup.py
+++ b/setup.py
@@ -108,6 +108,7 @@ setup(
         "packaging",
         "pandas[performance]>=2.0.3, <2.1",
         "parsedatetime",
+        "paramiko>=3.4.0",
         "pgsanity",
         "polyline>=2.0.0, <3.0",
         "pyparsing>=3.0.6, <4",