You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by el...@apache.org on 2023/10/19 23:41:34 UTC
[superset] branch 2.1 updated (1f104a0c50 -> 62547ccd05)
This is an automated email from the ASF dual-hosted git repository.
elizabeth pushed a change to branch 2.1
in repository https://gitbox.apache.org/repos/asf/superset.git
from 1f104a0c50 update changelog
new d80f326d53 chore(view_api): return application/json as content-type for api/v1/form_data endpoint (#24758)
new 19aaf12ed8 chore: bump wtforms and add missing flask-limiter (#23680)
new 62547ccd05 fix: update order of build for testing a release (#24317)
The 3 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:
docs/docs/contributing/testing-locally.mdx | 2 +-
requirements/base.txt | 39 ++++++++++++++++++++++++++++-
requirements/testing.txt | 1 -
setup.py | 2 +-
superset/connectors/sqla/views.py | 10 +++++---
superset/views/api.py | 2 +-
superset/views/database/forms.py | 18 ++++++-------
tests/integration_tests/charts/api_tests.py | 14 +++++++++++
8 files changed, 70 insertions(+), 18 deletions(-)
[superset] 03/03: fix: update order of build for testing a release (#24317)
Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
elizabeth pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 62547ccd05e109dcb91ee00b6abeda694332d28c
Author: Elizabeth Thompson <es...@gmail.com>
AuthorDate: Thu Jun 8 16:30:39 2023 -0700
fix: update order of build for testing a release (#24317)
---
docs/docs/contributing/testing-locally.mdx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/docs/contributing/testing-locally.mdx b/docs/docs/contributing/testing-locally.mdx
index ae08b1878a..780df3311a 100644
--- a/docs/docs/contributing/testing-locally.mdx
+++ b/docs/docs/contributing/testing-locally.mdx
@@ -93,8 +93,8 @@ export SUPERSET_TESTENV=true
export CYPRESS_BASE_URL="http://localhost:8081"
superset db upgrade
superset load_test_users
-superset load-examples --load-test-data
superset init
+superset load-examples --load-test-data
superset run --port 8081
```
[superset] 02/03: chore: bump wtforms and add missing flask-limiter (#23680)
Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
elizabeth pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 19aaf12ed88888934e06be93b220b2c9fb8935d2
Author: Daniel Vaz Gaspar <da...@gmail.com>
AuthorDate: Fri Apr 28 15:31:57 2023 +0100
chore: bump wtforms and add missing flask-limiter (#23680)
---
requirements/base.txt | 39 ++++++++++++++++++++++++++++++++++++++-
requirements/testing.txt | 1 -
setup.py | 2 +-
superset/connectors/sqla/views.py | 10 ++++++----
superset/views/database/forms.py | 18 +++++++++---------
5 files changed, 54 insertions(+), 16 deletions(-)
diff --git a/requirements/base.txt b/requirements/base.txt
index 142768d804..b119a8fce3 100644
--- a/requirements/base.txt
+++ b/requirements/base.txt
@@ -128,6 +128,10 @@ humanize==3.11.0
# via apache-superset
idna==3.2
# via email-validator
+importlib-metadata==6.3.0
+ # via flask
+importlib-resources==5.12.0
+ # via limits
isodate==0.6.0
# via apache-superset
itsdangerous==2.1.1
@@ -144,6 +148,8 @@ kombu==5.2.4
# via celery
korean-lunar-calendar==0.2.1
# via holidays
+limits==3.3.1
+ # via flask-limiter
mako==1.1.4
# via alembic
markdown==3.3.4
@@ -191,6 +197,11 @@ pyarrow==10.0.1
# via apache-superset
pycparser==2.20
# via cffi
+<<<<<<< HEAD
+=======
+pygments==2.15.0
+ # via rich
+>>>>>>> 31d33592e... chore: bump wtforms and add missing flask-limiter (#23680)
pyjwt==2.4.0
# via
# apache-superset
@@ -232,6 +243,11 @@ pyyaml==5.4.1
# apispec
redis==3.5.3
# via apache-superset
+<<<<<<< HEAD
+=======
+rich==13.3.4
+ # via flask-limiter
+>>>>>>> 31d33592e... chore: bump wtforms and add missing flask-limiter (#23680)
selenium==3.141.0
# via apache-superset
simplejson==3.17.3
@@ -269,7 +285,15 @@ sshtunnel==0.4.0
tabulate==0.8.9
# via apache-superset
typing-extensions==4.4.0
+<<<<<<< HEAD
# via apache-superset
+=======
+ # via
+ # apache-superset
+ # flask-limiter
+ # limits
+ # rich
+>>>>>>> 31d33592e... chore: bump wtforms and add missing flask-limiter (#23680)
urllib3==1.26.6
# via selenium
vine==5.0.0
@@ -286,16 +310,29 @@ werkzeug==2.1.2
# flask
# flask-jwt-extended
# flask-login
+<<<<<<< HEAD
wtforms==2.3.3
+=======
+wrapt==1.12.1
+ # via deprecated
+wtforms==3.0.1
+>>>>>>> 31d33592e... chore: bump wtforms and add missing flask-limiter (#23680)
# via
# apache-superset
# flask-appbuilder
# flask-wtf
# wtforms-json
-wtforms-json==0.3.3
+wtforms-json==0.3.5
# via apache-superset
xlsxwriter==3.0.7
# via apache-superset
+<<<<<<< HEAD
+=======
+zipp==3.15.0
+ # via
+ # importlib-metadata
+ # importlib-resources
+>>>>>>> 31d33592e... chore: bump wtforms and add missing flask-limiter (#23680)
# The following packages are considered to be unsafe in a requirements file:
# setuptools
diff --git a/requirements/testing.txt b/requirements/testing.txt
index 5312ea4f23..ead36ba3f6 100644
--- a/requirements/testing.txt
+++ b/requirements/testing.txt
@@ -139,7 +139,6 @@ websocket-client==1.2.0
# via docker
wrapt==1.12.1
# via astroid
-
# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools
diff --git a/setup.py b/setup.py
index 590ee0925b..05c6ca4ab5 100644
--- a/setup.py
+++ b/setup.py
@@ -123,7 +123,7 @@ setup(
"tabulate>=0.8.9, <0.9",
"typing-extensions>=4, <5",
"waitress; sys_platform == 'win32'",
- "wtforms>=2.3.3, <2.4",
+ "wtforms>=2.3.3, <4",
"wtforms-json",
"xlsxwriter>=3.0.7, <3.1",
],
diff --git a/superset/connectors/sqla/views.py b/superset/connectors/sqla/views.py
index 86cb08bb86..cb57792f97 100644
--- a/superset/connectors/sqla/views.py
+++ b/superset/connectors/sqla/views.py
@@ -21,11 +21,13 @@ from typing import Any, cast
from flask import current_app, flash, Markup, redirect
from flask_appbuilder import CompactCRUDMixin, expose
+from flask import flash, Markup, redirect
+from flask_appbuilder import CompactCRUDMixin, expose
+from flask_appbuilder.fields import QuerySelectField
from flask_appbuilder.fieldwidgets import Select2Widget
from flask_appbuilder.models.sqla.interface import SQLAInterface
from flask_appbuilder.security.decorators import has_access
from flask_babel import lazy_gettext as _
-from wtforms.ext.sqlalchemy.fields import QuerySelectField
from wtforms.validators import DataRequired, Regexp
from superset import app, db
@@ -186,7 +188,7 @@ class TableColumnInlineView( # pylint: disable=too-many-ancestors
add_form_extra_fields = {
"table": QuerySelectField(
"Table",
- query_factory=lambda: db.session.query(models.SqlaTable),
+ query_func=lambda: db.session.query(models.SqlaTable),
allow_blank=True,
widget=Select2Widget(extra_classes="readonly"),
)
@@ -261,7 +263,7 @@ class SqlMetricInlineView( # pylint: disable=too-many-ancestors
add_form_extra_fields = {
"table": QuerySelectField(
"Table",
- query_factory=lambda: db.session.query(models.SqlaTable),
+ query_func=lambda: db.session.query(models.SqlaTable),
allow_blank=True,
widget=Select2Widget(extra_classes="readonly"),
)
@@ -497,7 +499,7 @@ class TableModelView( # pylint: disable=too-many-ancestors
edit_form_extra_fields = {
"database": QuerySelectField(
"Database",
- query_factory=lambda: db.session.query(models.Database),
+ query_func=lambda: db.session.query(models.Database),
widget=Select2Widget(extra_classes="readonly"),
)
}
diff --git a/superset/views/database/forms.py b/superset/views/database/forms.py
index 91ab38dc2f..a93c76b5d9 100644
--- a/superset/views/database/forms.py
+++ b/superset/views/database/forms.py
@@ -17,6 +17,7 @@
"""Contains the logic to create cohesive forms on the explore view"""
from typing import List
+from flask_appbuilder.fields import QuerySelectField
from flask_appbuilder.fieldwidgets import BS3TextFieldWidget
from flask_appbuilder.forms import DynamicForm
from flask_babel import lazy_gettext as _
@@ -28,7 +29,6 @@ from wtforms import (
SelectField,
StringField,
)
-from wtforms.ext.sqlalchemy.fields import QuerySelectField
from wtforms.validators import DataRequired, Length, NumberRange, Optional, Regexp
from superset import app, db, security_manager
@@ -43,8 +43,8 @@ config = app.config
class UploadToDatabaseForm(DynamicForm):
- # pylint: disable=E0211
- def file_allowed_dbs() -> List[Database]: # type: ignore
+ @staticmethod
+ def file_allowed_dbs() -> List[Database]:
file_enabled_dbs = (
db.session.query(Database).filter_by(allow_file_upload=True).all()
)
@@ -136,8 +136,8 @@ class CsvToDatabaseForm(UploadToDatabaseForm):
database = QuerySelectField(
_("Database"),
description=_("Select a database to upload the file to"),
- query_factory=UploadToDatabaseForm.file_allowed_dbs,
- get_pk=lambda a: a.id,
+ query_func=UploadToDatabaseForm.file_allowed_dbs,
+ get_pk_func=lambda a: a.id,
get_label=lambda a: a.database_name,
)
schema = StringField(
@@ -303,8 +303,8 @@ class ExcelToDatabaseForm(UploadToDatabaseForm):
database = QuerySelectField(
_("Database"),
- query_factory=UploadToDatabaseForm.file_allowed_dbs,
- get_pk=lambda a: a.id,
+ query_func=UploadToDatabaseForm.file_allowed_dbs,
+ get_pk_func=lambda a: a.id,
get_label=lambda a: a.database_name,
)
schema = StringField(
@@ -434,8 +434,8 @@ class ColumnarToDatabaseForm(UploadToDatabaseForm):
database = QuerySelectField(
_("Database"),
- query_factory=UploadToDatabaseForm.file_allowed_dbs,
- get_pk=lambda a: a.id,
+ query_func=UploadToDatabaseForm.file_allowed_dbs,
+ get_pk_func=lambda a: a.id,
get_label=lambda a: a.database_name,
)
schema = StringField(
[superset] 01/03: chore(view_api): return application/json as content-type for api/v1/form_data endpoint (#24758)
Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
elizabeth pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/superset.git
commit d80f326d531f04bc871e55bf3ca2a33d7faff808
Author: Zef Lin <ze...@preset.io>
AuthorDate: Fri Jul 21 16:31:41 2023 -0700
chore(view_api): return application/json as content-type for api/v1/form_data endpoint (#24758)
(cherry picked from commit 0631a8086cd95f3b6e88b31d29c7fbc2e1d20b25)
---
superset/views/api.py | 2 +-
tests/integration_tests/charts/api_tests.py | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/superset/views/api.py b/superset/views/api.py
index fc7c5b76d2..820048d7c4 100644
--- a/superset/views/api.py
+++ b/superset/views/api.py
@@ -87,7 +87,7 @@ class Api(BaseSupersetView):
update_time_range(form_data)
- return json.dumps(form_data)
+ return self.json_response(form_data)
@api
@handle_api_exception
diff --git a/tests/integration_tests/charts/api_tests.py b/tests/integration_tests/charts/api_tests.py
index 02c5ce261e..98c4a49683 100644
--- a/tests/integration_tests/charts/api_tests.py
+++ b/tests/integration_tests/charts/api_tests.py
@@ -1371,6 +1371,20 @@ class TestChartApi(SupersetTestCase, ApiOwnersTestCaseMixin, InsertChartMixin):
self.assertEqual(rv.status_code, 200)
self.assertEqual(len(data["result"]), 3)
+ def test_query_form_data(self):
+ """
+ Chart API: Test query form data
+ """
+ self.login(username="admin")
+ slice = db.session.query(Slice).first()
+ uri = f"api/v1/form_data/?slice_id={slice.id if slice else None}"
+ rv = self.client.get(uri)
+ data = json.loads(rv.data.decode("utf-8"))
+ self.assertEqual(rv.status_code, 200)
+ self.assertEqual(rv.content_type, "application/json")
+ if slice:
+ self.assertEqual(data["slice_id"], slice.id)
+
@pytest.mark.usefixtures(
"load_unicode_dashboard_with_slice",
"load_energy_table_with_slice",