You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2023/11/20 15:07:48 UTC

(superset) branch fix-numeric updated (adf5119e28 -> bd840d62fd)

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

beto pushed a change to branch fix-numeric
in repository https://gitbox.apache.org/repos/asf/superset.git


    omit adf5119e28 feat(metadb): handle decimals
     new bd840d62fd feat(metadb): handle decimals

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (adf5119e28)
            \
             N -- N -- N   refs/heads/fix-numeric (bd840d62fd)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 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/integration.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


(superset) 01/01: feat(metadb): handle decimals

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

beto pushed a commit to branch fix-numeric
in repository https://gitbox.apache.org/repos/asf/superset.git

commit bd840d62fd04debbe1572868ed3973e32250b6dc
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Wed Nov 8 22:44:37 2023 -0500

    feat(metadb): handle decimals
---
 requirements/base.txt         | 35 ++++++++++++++++++++++++++++++-----
 requirements/development.txt  |  2 --
 requirements/integration.txt  |  4 ++--
 requirements/testing.txt      |  4 +---
 setup.py                      |  6 +++---
 superset/extensions/metadb.py | 15 +++++++++++++--
 6 files changed, 49 insertions(+), 17 deletions(-)

diff --git a/requirements/base.txt b/requirements/base.txt
index cc43587812..af9cf9b467 100644
--- a/requirements/base.txt
+++ b/requirements/base.txt
@@ -18,7 +18,10 @@ apsw==3.42.0.1
 async-timeout==4.0.2
     # via redis
 attrs==23.1.0
-    # via jsonschema
+    # via
+    #   cattrs
+    #   jsonschema
+    #   requests-cache
 babel==2.9.1
     # via flask-babel
 backoff==1.11.1
@@ -35,6 +38,8 @@ cachelib==0.9.0
     # via
     #   flask-caching
     #   flask-session
+cattrs==23.2.0
+    # via requests-cache
 celery==5.2.2
     # via apache-superset
 certifi==2023.7.22
@@ -85,6 +90,8 @@ dnspython==2.1.0
     # via email-validator
 email-validator==1.1.3
     # via flask-appbuilder
+exceptiongroup==1.1.3
+    # via cattrs
 flask==2.2.5
     # via
     #   apache-superset
@@ -136,7 +143,9 @@ geographiclib==1.52
 geopy==2.2.0
     # via apache-superset
 greenlet==2.0.2
-    # via shillelagh
+    # via
+    #   shillelagh
+    #   sqlalchemy
 gunicorn==21.2.0
     # via apache-superset
 hashids==1.3.1
@@ -152,7 +161,10 @@ idna==3.2
     #   email-validator
     #   requests
 importlib-metadata==6.6.0
-    # via apache-superset
+    # via
+    #   apache-superset
+    #   flask
+    #   shillelagh
 importlib-resources==5.12.0
     # via limits
 isodate==0.6.0
@@ -232,6 +244,8 @@ parsedatetime==2.6
     # via apache-superset
 pgsanity==0.2.9
     # via apache-superset
+platformdirs==4.0.0
+    # via requests-cache
 polyline==2.0.0
     # via apache-superset
 prison==0.2.1
@@ -285,12 +299,16 @@ pyyaml==6.0.1
 redis==4.5.4
     # via apache-superset
 requests==2.31.0
+    # via
+    #   requests-cache
+    #   shillelagh
+requests-cache==1.1.0
     # via shillelagh
 rich==13.3.4
     # via flask-limiter
 selenium==3.141.0
     # via apache-superset
-shillelagh==1.2.6
+shillelagh==1.2.10
     # via apache-superset
 shortid==0.1.2
     # via apache-superset
@@ -303,6 +321,7 @@ six==1.16.0
     #   paramiko
     #   prison
     #   python-dateutil
+    #   url-normalize
     #   wtforms-json
 slack-sdk==3.21.3
     # via apache-superset
@@ -328,14 +347,18 @@ tabulate==0.8.9
 typing-extensions==4.4.0
     # via
     #   apache-superset
+    #   cattrs
     #   flask-limiter
     #   limits
     #   shillelagh
 tzdata==2023.3
     # via pandas
+url-normalize==1.4.3
+    # via requests-cache
 urllib3==1.26.6
     # via
     #   requests
+    #   requests-cache
     #   selenium
 vine==5.0.0
     # via
@@ -363,7 +386,9 @@ wtforms-json==0.3.5
 xlsxwriter==3.0.7
     # via apache-superset
 zipp==3.15.0
-    # via importlib-metadata
+    # via
+    #   importlib-metadata
+    #   importlib-resources
 
 # The following packages are considered to be unsafe in a requirements file:
 # setuptools
diff --git a/requirements/development.txt b/requirements/development.txt
index 04962ae537..a73e3a70c5 100644
--- a/requirements/development.txt
+++ b/requirements/development.txt
@@ -74,8 +74,6 @@ pickleshare==0.7.5
     # via ipython
 pillow==9.5.0
     # via apache-superset
-platformdirs==3.8.1
-    # via pylint
 progress==1.6
     # via -r requirements/development.in
 psycopg2-binary==2.9.6
diff --git a/requirements/integration.txt b/requirements/integration.txt
index 0defdfc659..366a890d09 100644
--- a/requirements/integration.txt
+++ b/requirements/integration.txt
@@ -38,7 +38,7 @@ pip-compile-multi==2.6.3
     # via -r requirements/integration.in
 pip-tools==7.3.0
     # via pip-compile-multi
-platformdirs==3.8.1
+platformdirs==4.0.0
     # via
     #   tox
     #   virtualenv
@@ -62,7 +62,7 @@ toposort==1.10
     # via pip-compile-multi
 tox==4.6.4
     # via -r requirements/integration.in
-virtualenv==20.23.1
+virtualenv==20.24.6
     # via
     #   pre-commit
     #   tox
diff --git a/requirements/testing.txt b/requirements/testing.txt
index 00fe734540..8302d50329 100644
--- a/requirements/testing.txt
+++ b/requirements/testing.txt
@@ -26,8 +26,6 @@ docker==6.1.1
     # via -r requirements/testing.in
 ephem==4.1.4
     # via lunarcalendar
-exceptiongroup==1.1.1
-    # via pytest
 flask-testing==0.8.1
     # via -r requirements/testing.in
 fonttools==4.39.4
@@ -144,7 +142,7 @@ rsa==4.9
     # via google-auth
 setuptools-git==1.2
     # via prophet
-shillelagh[gsheetsapi]==1.2.6
+shillelagh[gsheetsapi]==1.2.10
     # via apache-superset
 sqlalchemy-bigquery==1.6.1
     # via apache-superset
diff --git a/setup.py b/setup.py
index 88f2c0fba5..bc92e16aa0 100644
--- a/setup.py
+++ b/setup.py
@@ -118,7 +118,7 @@ setup(
         "PyJWT>=2.4.0, <3.0",
         "redis>=4.5.4, <5.0",
         "selenium>=3.141.0, <4.10.0",
-        "shillelagh>=1.2.6,<2.0",
+        "shillelagh>=1.2.10,<2.0",
         "shortid",
         "sshtunnel>=0.4.0, <0.5",
         "simplejson>=3.15.0",
@@ -162,7 +162,7 @@ setup(
         "excel": ["xlrd>=1.2.0, <1.3"],
         "firebird": ["sqlalchemy-firebird>=0.7.0, <0.8"],
         "firebolt": ["firebolt-sqlalchemy>=0.0.1"],
-        "gsheets": ["shillelagh[gsheetsapi]>=1.2.6, <2"],
+        "gsheets": ["shillelagh[gsheetsapi]>=1.2.10, <2"],
         "hana": ["hdbcli==2.4.162", "sqlalchemy_hana==0.4.0"],
         "hive": [
             "pyhive[hive]>=0.6.5;python_version<'3.11'",
@@ -191,7 +191,7 @@ setup(
         "redshift": ["sqlalchemy-redshift>=0.8.1, < 0.9"],
         "rockset": ["rockset-sqlalchemy>=0.0.1, <1.0.0"],
         "shillelagh": [
-            "shillelagh[datasetteapi,gsheetsapi,socrata,weatherapi]>=1.2.6,<2"
+            "shillelagh[datasetteapi,gsheetsapi,socrata,weatherapi]>=1.2.10,<2"
         ],
         "snowflake": ["snowflake-sqlalchemy>=1.2.4, <2"],
         "spark": [
diff --git a/superset/extensions/metadb.py b/superset/extensions/metadb.py
index 5b014b7af6..305ac86dd0 100644
--- a/superset/extensions/metadb.py
+++ b/superset/extensions/metadb.py
@@ -38,6 +38,7 @@ joins and unions are done in memory, using the SQLite engine.
 from __future__ import annotations
 
 import datetime
+import decimal
 import operator
 import urllib.parse
 from collections.abc import Iterator
@@ -86,7 +87,7 @@ class SupersetAPSWDialect(APSWDialect):
 
     Queries can also join data across different Superset databases.
 
-    The dialect is built in top of the shillelagh library, leveraging SQLite to
+    The dialect is built in top of the Shillelagh library, leveraging SQLite to
     create virtual tables on-the-fly proxying Superset tables. The
     `SupersetShillelaghAdapter` adapter is responsible for returning data when a
     Superset table is accessed.
@@ -164,11 +165,20 @@ class Duration(Field[datetime.timedelta, datetime.timedelta]):
     db_api_type = "DATETIME"
 
 
+class Decimal(Field[decimal.Decimal, decimal.Decimal]):
+    """
+    Shillelagh field used for representing decimals.
+    """
+
+    type = "DECIMAL"
+    db_api_type = "NUMBER"
+
+
 # pylint: disable=too-many-instance-attributes
 class SupersetShillelaghAdapter(Adapter):
 
     """
-    A shillelagh adapter for Superset tables.
+    A Shillelagh adapter for Superset tables.
 
     Shillelagh adapters are responsible for fetching data from a given resource,
     allowing it to be represented as a virtual table in SQLite. This one works
@@ -190,6 +200,7 @@ class SupersetShillelaghAdapter(Adapter):
         datetime.datetime: DateTime,
         datetime.time: Time,
         datetime.timedelta: Duration,
+        decimal.Decimal: Decimal,
     }
 
     @staticmethod