mirror of https://github.com/apache/superset.git
refactor: Unify all json.(loads|dumps) usage to utils.json (#28702)
Co-authored-by: Eyal Ezer <eyal.ezer@ge.com>
This commit is contained in:
parent
87110ebce4
commit
07b2449bd7
|
@ -36,7 +36,7 @@ persistent=yes
|
||||||
|
|
||||||
# List of plugins (as comma separated values of python modules names) to load,
|
# List of plugins (as comma separated values of python modules names) to load,
|
||||||
# usually to register additional checkers.
|
# usually to register additional checkers.
|
||||||
load-plugins=
|
load-plugins=superset.extensions.pylint
|
||||||
|
|
||||||
# Use multiple processes to speed up Pylint.
|
# Use multiple processes to speed up Pylint.
|
||||||
jobs=2
|
jobs=2
|
||||||
|
|
|
@ -19,8 +19,7 @@ from typing import Union
|
||||||
from marshmallow import fields, Schema, ValidationError
|
from marshmallow import fields, Schema, ValidationError
|
||||||
from marshmallow.validate import Length
|
from marshmallow.validate import Length
|
||||||
|
|
||||||
from superset.exceptions import SupersetException
|
from superset.utils import json
|
||||||
from superset.utils import json as json_utils
|
|
||||||
|
|
||||||
openapi_spec_methods_override = {
|
openapi_spec_methods_override = {
|
||||||
"get": {"get": {"summary": "Get an annotation layer"}},
|
"get": {"get": {"summary": "Get an annotation layer"}},
|
||||||
|
@ -51,8 +50,8 @@ annotation_json_metadata = "JSON metadata"
|
||||||
|
|
||||||
def validate_json(value: Union[bytes, bytearray, str]) -> None:
|
def validate_json(value: Union[bytes, bytearray, str]) -> None:
|
||||||
try:
|
try:
|
||||||
json_utils.validate_json(value)
|
json.validate_json(value)
|
||||||
except SupersetException as ex:
|
except json.JSONDecodeError as ex:
|
||||||
raise ValidationError("JSON not valid") from ex
|
raise ValidationError("JSON not valid") from ex
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import uuid
|
import uuid
|
||||||
from typing import Any, Literal, Optional
|
from typing import Any, Literal, Optional
|
||||||
|
@ -23,6 +22,7 @@ import jwt
|
||||||
import redis
|
import redis
|
||||||
from flask import Flask, Request, request, Response, session
|
from flask import Flask, Request, request, Response, session
|
||||||
|
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.core import get_user_id
|
from superset.utils.core import get_user_id
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
# pylint: disable=too-many-lines
|
# pylint: disable=too-many-lines
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
@ -81,6 +80,7 @@ from superset.extensions import event_logger
|
||||||
from superset.models.slice import Slice
|
from superset.models.slice import Slice
|
||||||
from superset.tasks.thumbnails import cache_chart_thumbnail
|
from superset.tasks.thumbnails import cache_chart_thumbnail
|
||||||
from superset.tasks.utils import get_current_user
|
from superset.tasks.utils import get_current_user
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.screenshots import ChartScreenshot, DEFAULT_CHART_WINDOW_SIZE
|
from superset.utils.screenshots import ChartScreenshot, DEFAULT_CHART_WINDOW_SIZE
|
||||||
from superset.utils.urls import get_url_path
|
from superset.utils.urls import get_url_path
|
||||||
from superset.views.base_api import (
|
from superset.views.base_api import (
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, TYPE_CHECKING
|
from typing import Any, TYPE_CHECKING
|
||||||
|
|
||||||
|
@ -46,7 +45,7 @@ from superset.daos.exceptions import DatasourceNotFound
|
||||||
from superset.exceptions import QueryObjectValidationError
|
from superset.exceptions import QueryObjectValidationError
|
||||||
from superset.extensions import event_logger
|
from superset.extensions import event_logger
|
||||||
from superset.models.sql_lab import Query
|
from superset.models.sql_lab import Query
|
||||||
from superset.utils import json as json_utils
|
from superset.utils import json
|
||||||
from superset.utils.core import (
|
from superset.utils.core import (
|
||||||
create_zip,
|
create_zip,
|
||||||
DatasourceType,
|
DatasourceType,
|
||||||
|
@ -129,7 +128,7 @@ class ChartDataRestApi(ChartRestApi):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
json_body = json.loads(chart.query_context)
|
json_body = json.loads(chart.query_context)
|
||||||
except (TypeError, json.decoder.JSONDecodeError):
|
except (TypeError, json.JSONDecodeError):
|
||||||
json_body = None
|
json_body = None
|
||||||
|
|
||||||
if json_body is None:
|
if json_body is None:
|
||||||
|
@ -171,7 +170,7 @@ class ChartDataRestApi(ChartRestApi):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
form_data = json.loads(chart.params)
|
form_data = json.loads(chart.params)
|
||||||
except (TypeError, json.decoder.JSONDecodeError):
|
except (TypeError, json.JSONDecodeError):
|
||||||
form_data = {}
|
form_data = {}
|
||||||
|
|
||||||
return self._get_data_response(
|
return self._get_data_response(
|
||||||
|
@ -395,9 +394,9 @@ class ChartDataRestApi(ChartRestApi):
|
||||||
)
|
)
|
||||||
|
|
||||||
if result_format == ChartDataResultFormat.JSON:
|
if result_format == ChartDataResultFormat.JSON:
|
||||||
response_data = json_utils.dumps(
|
response_data = json.dumps(
|
||||||
{"result": result["queries"]},
|
{"result": result["queries"]},
|
||||||
default=json_utils.json_int_dttm_ser,
|
default=json.json_int_dttm_ser,
|
||||||
ignore_nan=True,
|
ignore_nan=True,
|
||||||
)
|
)
|
||||||
resp = make_response(response_data, 200)
|
resp = make_response(response_data, 200)
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
# isort:skip_file
|
# isort:skip_file
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from collections.abc import Iterator
|
from collections.abc import Iterator
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
@ -30,6 +29,7 @@ from superset.commands.export.models import ExportModelsCommand
|
||||||
from superset.models.slice import Slice
|
from superset.models.slice import Slice
|
||||||
from superset.utils.dict_import_export import EXPORT_VERSION
|
from superset.utils.dict_import_export import EXPORT_VERSION
|
||||||
from superset.utils.file import get_filename
|
from superset.utils.file import get_filename
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ class ExportChartsCommand(ExportModelsCommand):
|
||||||
if payload.get("params"):
|
if payload.get("params"):
|
||||||
try:
|
try:
|
||||||
payload["params"] = json.loads(payload["params"])
|
payload["params"] = json.loads(payload["params"])
|
||||||
except json.decoder.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
logger.info("Unable to decode `params` field: %s", payload["params"])
|
logger.info("Unable to decode `params` field: %s", payload["params"])
|
||||||
|
|
||||||
payload["version"] = EXPORT_VERSION
|
payload["version"] = EXPORT_VERSION
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
import json
|
|
||||||
from inspect import isclass
|
from inspect import isclass
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
@ -25,6 +24,7 @@ from superset.commands.exceptions import ImportFailedError
|
||||||
from superset.migrations.shared.migrate_viz import processors
|
from superset.migrations.shared.migrate_viz import processors
|
||||||
from superset.migrations.shared.migrate_viz.base import MigrateViz
|
from superset.migrations.shared.migrate_viz.base import MigrateViz
|
||||||
from superset.models.slice import Slice
|
from superset.models.slice import Slice
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.core import AnnotationType, get_user
|
from superset.utils.core import AnnotationType, get_user
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ def migrate_chart(config: dict[str, Any]) -> dict[str, Any]:
|
||||||
# also update `query_context`
|
# also update `query_context`
|
||||||
try:
|
try:
|
||||||
query_context = json.loads(output.get("query_context") or "{}")
|
query_context = json.loads(output.get("query_context") or "{}")
|
||||||
except (json.decoder.JSONDecodeError, TypeError):
|
except (json.JSONDecodeError, TypeError):
|
||||||
query_context = {}
|
query_context = {}
|
||||||
if "form_data" in query_context:
|
if "form_data" in query_context:
|
||||||
query_context["form_data"] = output["params"]
|
query_context["form_data"] = output["params"]
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
|
|
||||||
from typing import Any, Optional, Union
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
import simplejson as json
|
|
||||||
from flask import g
|
from flask import g
|
||||||
|
|
||||||
from superset.commands.base import BaseCommand
|
from superset.commands.base import BaseCommand
|
||||||
|
@ -29,6 +28,7 @@ from superset.commands.chart.exceptions import (
|
||||||
)
|
)
|
||||||
from superset.extensions import db
|
from superset.extensions import db
|
||||||
from superset.models.slice import Slice
|
from superset.models.slice import Slice
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.core import error_msg_from_exception
|
from superset.utils.core import error_msg_from_exception
|
||||||
from superset.views.utils import get_dashboard_extra_filters, get_form_data, get_viz
|
from superset.views.utils import get_dashboard_extra_filters, get_form_data, get_viz
|
||||||
from superset.viz import viz_types
|
from superset.viz import viz_types
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
# isort:skip_file
|
# isort:skip_file
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
|
@ -36,6 +35,7 @@ from superset.models.dashboard import Dashboard
|
||||||
from superset.models.slice import Slice
|
from superset.models.slice import Slice
|
||||||
from superset.utils.dict_import_export import EXPORT_VERSION
|
from superset.utils.dict_import_export import EXPORT_VERSION
|
||||||
from superset.utils.file import get_filename
|
from superset.utils.file import get_filename
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ class ExportDashboardsCommand(ExportModelsCommand):
|
||||||
if value:
|
if value:
|
||||||
try:
|
try:
|
||||||
payload[new_name] = json.loads(value)
|
payload[new_name] = json.loads(value)
|
||||||
except (TypeError, json.decoder.JSONDecodeError):
|
except (TypeError, json.JSONDecodeError):
|
||||||
logger.info("Unable to decode `%s` field: %s", key, value)
|
logger.info("Unable to decode `%s` field: %s", key, value)
|
||||||
payload[new_name] = {}
|
payload[new_name] = {}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ class ExportDashboardsCommand(ExportModelsCommand):
|
||||||
if value:
|
if value:
|
||||||
try:
|
try:
|
||||||
payload[new_name] = json.loads(value)
|
payload[new_name] = json.loads(value)
|
||||||
except (TypeError, json.decoder.JSONDecodeError):
|
except (TypeError, json.JSONDecodeError):
|
||||||
logger.info("Unable to decode `%s` field: %s", key, value)
|
logger.info("Unable to decode `%s` field: %s", key, value)
|
||||||
payload[new_name] = {}
|
payload[new_name] = {}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
from copy import copy
|
from copy import copy
|
||||||
|
@ -32,6 +31,7 @@ from superset.exceptions import DashboardImportException
|
||||||
from superset.migrations.shared.native_filters import migrate_dashboard
|
from superset.migrations.shared.native_filters import migrate_dashboard
|
||||||
from superset.models.dashboard import Dashboard
|
from superset.models.dashboard import Dashboard
|
||||||
from superset.models.slice import Slice
|
from superset.models.slice import Slice
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.dashboard_filter_scopes_converter import (
|
from superset.utils.dashboard_filter_scopes_converter import (
|
||||||
convert_filter_scopes,
|
convert_filter_scopes,
|
||||||
copy_filter_scopes,
|
copy_filter_scopes,
|
||||||
|
|
|
@ -15,13 +15,13 @@
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from superset import db, security_manager
|
from superset import db, security_manager
|
||||||
from superset.commands.exceptions import ImportFailedError
|
from superset.commands.exceptions import ImportFailedError
|
||||||
from superset.models.dashboard import Dashboard
|
from superset.models.dashboard import Dashboard
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.core import get_user
|
from superset.utils.core import get_user
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
|
@ -37,6 +36,7 @@ from superset.exceptions import SupersetSecurityException
|
||||||
from superset.extensions import db
|
from superset.extensions import db
|
||||||
from superset.models.dashboard import Dashboard
|
from superset.models.dashboard import Dashboard
|
||||||
from superset.tags.models import ObjectType
|
from superset.tags.models import ObjectType
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
# isort:skip_file
|
# isort:skip_file
|
||||||
import functools
|
import functools
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, Callable
|
from typing import Any, Callable
|
||||||
from collections.abc import Iterator
|
from collections.abc import Iterator
|
||||||
|
@ -30,6 +29,7 @@ from superset.models.core import Database
|
||||||
from superset.utils.dict_import_export import EXPORT_VERSION
|
from superset.utils.dict_import_export import EXPORT_VERSION
|
||||||
from superset.utils.file import get_filename
|
from superset.utils.file import get_filename
|
||||||
from superset.utils.ssh_tunnel import mask_password_info
|
from superset.utils.ssh_tunnel import mask_password_info
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ logger = logging.getLogger(__name__)
|
||||||
def parse_extra(extra_payload: str) -> dict[str, Any]:
|
def parse_extra(extra_payload: str) -> dict[str, Any]:
|
||||||
try:
|
try:
|
||||||
extra = json.loads(extra_payload)
|
extra = json.loads(extra_payload)
|
||||||
except json.decoder.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
logger.info("Unable to decode `extra` field: %s", extra_payload)
|
logger.info("Unable to decode `extra` field: %s", extra_payload)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from superset import app, db, security_manager
|
from superset import app, db, security_manager
|
||||||
|
@ -25,6 +24,7 @@ from superset.databases.utils import make_url_safe
|
||||||
from superset.exceptions import SupersetSecurityException
|
from superset.exceptions import SupersetSecurityException
|
||||||
from superset.models.core import Database
|
from superset.models.core import Database
|
||||||
from superset.security.analytics_db_safety import check_sqlalchemy_uri
|
from superset.security.analytics_db_safety import check_sqlalchemy_uri
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
|
|
||||||
def import_database(
|
def import_database(
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
from contextlib import closing
|
from contextlib import closing
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
|
@ -33,6 +32,7 @@ from superset.db_engine_specs import get_engine_spec
|
||||||
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
|
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
|
||||||
from superset.extensions import event_logger
|
from superset.extensions import event_logger
|
||||||
from superset.models.core import Database
|
from superset.models.core import Database
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
BYPASS_VALIDATION_ENGINES = {"bigquery"}
|
BYPASS_VALIDATION_ENGINES = {"bigquery"}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ class ValidateDatabaseParametersCommand(BaseCommand):
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
encrypted_extra = json.loads(serialized_encrypted_extra)
|
encrypted_extra = json.loads(serialized_encrypted_extra)
|
||||||
except json.decoder.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
encrypted_extra = {}
|
encrypted_extra = {}
|
||||||
|
|
||||||
# try to connect
|
# try to connect
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
# isort:skip_file
|
# isort:skip_file
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from collections.abc import Iterator
|
from collections.abc import Iterator
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
@ -31,6 +30,7 @@ from superset.daos.dataset import DatasetDAO
|
||||||
from superset.utils.dict_import_export import EXPORT_VERSION
|
from superset.utils.dict_import_export import EXPORT_VERSION
|
||||||
from superset.utils.file import get_filename
|
from superset.utils.file import get_filename
|
||||||
from superset.utils.ssh_tunnel import mask_password_info
|
from superset.utils.ssh_tunnel import mask_password_info
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -63,14 +63,14 @@ class ExportDatasetsCommand(ExportModelsCommand):
|
||||||
if payload.get(key):
|
if payload.get(key):
|
||||||
try:
|
try:
|
||||||
payload[key] = json.loads(payload[key])
|
payload[key] = json.loads(payload[key])
|
||||||
except json.decoder.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
logger.info("Unable to decode `%s` field: %s", key, payload[key])
|
logger.info("Unable to decode `%s` field: %s", key, payload[key])
|
||||||
for key in ("metrics", "columns"):
|
for key in ("metrics", "columns"):
|
||||||
for attributes in payload.get(key, []):
|
for attributes in payload.get(key, []):
|
||||||
if attributes.get("extra"):
|
if attributes.get("extra"):
|
||||||
try:
|
try:
|
||||||
attributes["extra"] = json.loads(attributes["extra"])
|
attributes["extra"] = json.loads(attributes["extra"])
|
||||||
except json.decoder.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
logger.info(
|
logger.info(
|
||||||
"Unable to decode `extra` field: %s", attributes["extra"]
|
"Unable to decode `extra` field: %s", attributes["extra"]
|
||||||
)
|
)
|
||||||
|
@ -108,7 +108,7 @@ class ExportDatasetsCommand(ExportModelsCommand):
|
||||||
if payload.get("extra"):
|
if payload.get("extra"):
|
||||||
try:
|
try:
|
||||||
payload["extra"] = json.loads(payload["extra"])
|
payload["extra"] = json.loads(payload["extra"])
|
||||||
except json.decoder.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
logger.info("Unable to decode `extra` field: %s", payload["extra"])
|
logger.info("Unable to decode `extra` field: %s", payload["extra"])
|
||||||
|
|
||||||
if ssh_tunnel := DatabaseDAO.get_ssh_tunnel(model.database.id):
|
if ssh_tunnel := DatabaseDAO.get_ssh_tunnel(model.database.id):
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, Callable, Optional
|
from typing import Any, Callable, Optional
|
||||||
|
|
||||||
|
@ -34,6 +33,7 @@ from superset.connectors.sqla.models import (
|
||||||
TableColumn,
|
TableColumn,
|
||||||
)
|
)
|
||||||
from superset.models.core import Database
|
from superset.models.core import Database
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.dict_import_export import DATABASES_KEY
|
from superset.utils.dict_import_export import DATABASES_KEY
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import gzip
|
import gzip
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@ -33,6 +32,7 @@ from superset.commands.exceptions import ImportFailedError
|
||||||
from superset.connectors.sqla.models import SqlaTable
|
from superset.connectors.sqla.models import SqlaTable
|
||||||
from superset.models.core import Database
|
from superset.models.core import Database
|
||||||
from superset.sql_parse import Table
|
from superset.sql_parse import Table
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.core import get_user
|
from superset.utils.core import get_user
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
|
@ -19,7 +19,6 @@ import logging
|
||||||
from abc import ABC
|
from abc import ABC
|
||||||
from typing import Any, cast, Optional
|
from typing import Any, cast, Optional
|
||||||
|
|
||||||
import simplejson as json
|
|
||||||
from flask import request
|
from flask import request
|
||||||
from flask_babel import lazy_gettext as _
|
from flask_babel import lazy_gettext as _
|
||||||
from sqlalchemy.exc import SQLAlchemyError
|
from sqlalchemy.exc import SQLAlchemyError
|
||||||
|
@ -38,7 +37,7 @@ from superset.exceptions import SupersetException
|
||||||
from superset.explore.exceptions import WrongEndpointError
|
from superset.explore.exceptions import WrongEndpointError
|
||||||
from superset.explore.permalink.exceptions import ExplorePermalinkGetFailedError
|
from superset.explore.permalink.exceptions import ExplorePermalinkGetFailedError
|
||||||
from superset.extensions import security_manager
|
from superset.extensions import security_manager
|
||||||
from superset.utils import core as utils
|
from superset.utils import core as utils, json
|
||||||
from superset.views.utils import (
|
from superset.views.utils import (
|
||||||
get_datasource_info,
|
get_datasource_info,
|
||||||
get_form_data,
|
get_form_data,
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
# isort:skip_file
|
# isort:skip_file
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from collections.abc import Iterator
|
from collections.abc import Iterator
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
@ -29,6 +28,7 @@ from superset.models.sql_lab import SavedQuery
|
||||||
from superset.commands.query.exceptions import SavedQueryNotFoundError
|
from superset.commands.query.exceptions import SavedQueryNotFoundError
|
||||||
from superset.daos.query import SavedQueryDAO
|
from superset.daos.query import SavedQueryDAO
|
||||||
from superset.utils.dict_import_export import EXPORT_VERSION
|
from superset.utils.dict_import_export import EXPORT_VERSION
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ class ExportSavedQueriesCommand(ExportModelsCommand):
|
||||||
if "extra" in payload:
|
if "extra" in payload:
|
||||||
try:
|
try:
|
||||||
payload["extra"] = json.loads(payload["extra"])
|
payload["extra"] = json.loads(payload["extra"])
|
||||||
except json.decoder.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
logger.info("Unable to decode `extra` field: %s", payload["extra"])
|
logger.info("Unable to decode `extra` field: %s", payload["extra"])
|
||||||
|
|
||||||
payload["version"] = EXPORT_VERSION
|
payload["version"] = EXPORT_VERSION
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from operator import eq, ge, gt, le, lt, ne
|
from operator import eq, ge, gt, le, lt, ne
|
||||||
from timeit import default_timer
|
from timeit import default_timer
|
||||||
|
@ -39,6 +38,7 @@ from superset.commands.report.exceptions import (
|
||||||
)
|
)
|
||||||
from superset.reports.models import ReportSchedule, ReportScheduleValidatorType
|
from superset.reports.models import ReportSchedule, ReportScheduleValidatorType
|
||||||
from superset.tasks.utils import get_executor
|
from superset.tasks.utils import get_executor
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.core import override_user
|
from superset.utils.core import override_user
|
||||||
from superset.utils.retries import retry_call
|
from superset.utils.retries import retry_call
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
|
@ -40,6 +39,7 @@ from superset.reports.models import (
|
||||||
ReportScheduleType,
|
ReportScheduleType,
|
||||||
)
|
)
|
||||||
from superset.reports.types import ReportScheduleExtra
|
from superset.reports.types import ReportScheduleExtra
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Any, Optional, Union
|
from typing import Any, Optional, Union
|
||||||
|
@ -67,6 +66,7 @@ from superset.reports.notifications import create_notification
|
||||||
from superset.reports.notifications.base import NotificationContent
|
from superset.reports.notifications.base import NotificationContent
|
||||||
from superset.reports.notifications.exceptions import NotificationError
|
from superset.reports.notifications.exceptions import NotificationError
|
||||||
from superset.tasks.utils import get_executor
|
from superset.tasks.utils import get_executor
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.core import HeaderDataType, override_user
|
from superset.utils.core import HeaderDataType, override_user
|
||||||
from superset.utils.csv import get_chart_csv_data, get_chart_dataframe
|
from superset.utils.csv import get_chart_csv_data, get_chart_dataframe
|
||||||
from superset.utils.decorators import logs_context
|
from superset.utils.decorators import logs_context
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
|
@ -37,6 +36,7 @@ from superset.daos.exceptions import DAOUpdateFailedError
|
||||||
from superset.daos.report import ReportScheduleDAO
|
from superset.daos.report import ReportScheduleDAO
|
||||||
from superset.exceptions import SupersetSecurityException
|
from superset.exceptions import SupersetSecurityException
|
||||||
from superset.reports.models import ReportSchedule, ReportScheduleType, ReportState
|
from superset.reports.models import ReportSchedule, ReportScheduleType, ReportState
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
# pylint: disable=invalid-name
|
# pylint: disable=invalid-name
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
|
@ -36,7 +35,7 @@ from superset.exceptions import (
|
||||||
)
|
)
|
||||||
from superset.sql_parse import sanitize_clause
|
from superset.sql_parse import sanitize_clause
|
||||||
from superset.superset_typing import Column, Metric, OrderBy
|
from superset.superset_typing import Column, Metric, OrderBy
|
||||||
from superset.utils import pandas_postprocessing
|
from superset.utils import json, pandas_postprocessing
|
||||||
from superset.utils.core import (
|
from superset.utils.core import (
|
||||||
DTTM_ALIAS,
|
DTTM_ALIAS,
|
||||||
find_duplicates,
|
find_duplicates,
|
||||||
|
|
|
@ -19,14 +19,12 @@ from __future__ import annotations
|
||||||
|
|
||||||
import builtins
|
import builtins
|
||||||
import dataclasses
|
import dataclasses
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from collections.abc import Hashable
|
from collections.abc import Hashable
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from json.decoder import JSONDecodeError
|
|
||||||
from typing import Any, Callable, cast
|
from typing import Any, Callable, cast
|
||||||
|
|
||||||
import dateutil.parser
|
import dateutil.parser
|
||||||
|
@ -118,7 +116,7 @@ from superset.superset_typing import (
|
||||||
QueryObjectDict,
|
QueryObjectDict,
|
||||||
ResultSetColumnType,
|
ResultSetColumnType,
|
||||||
)
|
)
|
||||||
from superset.utils import core as utils
|
from superset.utils import core as utils, json
|
||||||
from superset.utils.backports import StrEnum
|
from superset.utils.backports import StrEnum
|
||||||
from superset.utils.core import GenericDataType, MediumText
|
from superset.utils.core import GenericDataType, MediumText
|
||||||
|
|
||||||
|
@ -1051,7 +1049,7 @@ class SqlMetric(AuditMixinNullable, ImportExportMixin, CertificationMixin, Model
|
||||||
def currency_json(self) -> dict[str, str | None] | None:
|
def currency_json(self) -> dict[str, str | None] | None:
|
||||||
try:
|
try:
|
||||||
return json.loads(self.currency or "{}") or None
|
return json.loads(self.currency or "{}") or None
|
||||||
except (TypeError, JSONDecodeError) as exc:
|
except (TypeError, json.JSONDecodeError) as exc:
|
||||||
logger.error(
|
logger.error(
|
||||||
"Unable to load currency json: %r. Leaving empty.", exc, exc_info=True
|
"Unable to load currency json: %r. Leaving empty.", exc, exc_info=True
|
||||||
)
|
)
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@ -38,6 +37,7 @@ from superset.models.core import FavStar, FavStarClassName
|
||||||
from superset.models.dashboard import Dashboard, id_or_slug_filter
|
from superset.models.dashboard import Dashboard, id_or_slug_filter
|
||||||
from superset.models.embedded_dashboard import EmbeddedDashboard
|
from superset.models.embedded_dashboard import EmbeddedDashboard
|
||||||
from superset.models.slice import Slice
|
from superset.models.slice import Slice
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.core import get_user_id
|
from superset.utils.core import get_user_id
|
||||||
from superset.utils.dashboard_filter_scopes_converter import copy_filter_scopes
|
from superset.utils.dashboard_filter_scopes_converter import copy_filter_scopes
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@ -34,6 +33,7 @@ from superset.reports.models import (
|
||||||
ReportScheduleType,
|
ReportScheduleType,
|
||||||
ReportState,
|
ReportState,
|
||||||
)
|
)
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.core import get_user_id
|
from superset.utils.core import get_user_id
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
# pylint: disable=too-many-lines
|
# pylint: disable=too-many-lines
|
||||||
import functools
|
import functools
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
@ -84,6 +83,7 @@ from superset.models.dashboard import Dashboard
|
||||||
from superset.models.embedded_dashboard import EmbeddedDashboard
|
from superset.models.embedded_dashboard import EmbeddedDashboard
|
||||||
from superset.tasks.thumbnails import cache_dashboard_thumbnail
|
from superset.tasks.thumbnails import cache_dashboard_thumbnail
|
||||||
from superset.tasks.utils import get_current_user
|
from superset.tasks.utils import get_current_user
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.screenshots import DashboardScreenshot
|
from superset.utils.screenshots import DashboardScreenshot
|
||||||
from superset.utils.urls import get_url_path
|
from superset.utils.urls import get_url_path
|
||||||
from superset.views.base_api import (
|
from superset.views.base_api import (
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
import re
|
import re
|
||||||
from typing import Any, Union
|
from typing import Any, Union
|
||||||
|
|
||||||
|
@ -22,9 +21,8 @@ from marshmallow import fields, post_dump, post_load, pre_load, Schema
|
||||||
from marshmallow.validate import Length, ValidationError
|
from marshmallow.validate import Length, ValidationError
|
||||||
|
|
||||||
from superset import security_manager
|
from superset import security_manager
|
||||||
from superset.exceptions import SupersetException
|
|
||||||
from superset.tags.models import TagType
|
from superset.tags.models import TagType
|
||||||
from superset.utils import json as json_utils
|
from superset.utils import json
|
||||||
|
|
||||||
get_delete_ids_schema = {"type": "array", "items": {"type": "integer"}}
|
get_delete_ids_schema = {"type": "array", "items": {"type": "integer"}}
|
||||||
get_export_ids_schema = {"type": "array", "items": {"type": "integer"}}
|
get_export_ids_schema = {"type": "array", "items": {"type": "integer"}}
|
||||||
|
@ -89,8 +87,8 @@ openapi_spec_methods_override = {
|
||||||
|
|
||||||
def validate_json(value: Union[bytes, bytearray, str]) -> None:
|
def validate_json(value: Union[bytes, bytearray, str]) -> None:
|
||||||
try:
|
try:
|
||||||
json_utils.validate_json(value)
|
json.validate_json(value)
|
||||||
except SupersetException as ex:
|
except json.JSONDecodeError as ex:
|
||||||
raise ValidationError("JSON not valid") from ex
|
raise ValidationError("JSON not valid") from ex
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,7 +97,7 @@ def validate_json_metadata(value: Union[bytes, bytearray, str]) -> None:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
value_obj = json.loads(value)
|
value_obj = json.loads(value)
|
||||||
except json.decoder.JSONDecodeError as ex:
|
except json.JSONDecodeError as ex:
|
||||||
raise ValidationError("JSON not valid") from ex
|
raise ValidationError("JSON not valid") from ex
|
||||||
errors = DashboardJSONMetadataSchema().validate(value_obj, partial=False)
|
errors = DashboardJSONMetadataSchema().validate(value_obj, partial=False)
|
||||||
if errors:
|
if errors:
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
@ -120,6 +119,7 @@ from superset.extensions import security_manager
|
||||||
from superset.models.core import Database
|
from superset.models.core import Database
|
||||||
from superset.sql_parse import Table
|
from superset.sql_parse import Table
|
||||||
from superset.superset_typing import FlaskResponse
|
from superset.superset_typing import FlaskResponse
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.core import error_msg_from_exception, parse_js_uri_path_item
|
from superset.utils.core import error_msg_from_exception, parse_js_uri_path_item
|
||||||
from superset.utils.oauth2 import decode_oauth2_state
|
from superset.utils.oauth2 import decode_oauth2_state
|
||||||
from superset.utils.ssh_tunnel import mask_password_info
|
from superset.utils.ssh_tunnel import mask_password_info
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
import json
|
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, TypedDict
|
from typing import Any, TypedDict
|
||||||
|
@ -53,6 +52,7 @@ from superset.db_engine_specs import get_engine_spec
|
||||||
from superset.exceptions import CertificateException, SupersetSecurityException
|
from superset.exceptions import CertificateException, SupersetSecurityException
|
||||||
from superset.models.core import ConfigurationMethod, Database
|
from superset.models.core import ConfigurationMethod, Database
|
||||||
from superset.security.analytics_db_safety import check_sqlalchemy_uri
|
from superset.security.analytics_db_safety import check_sqlalchemy_uri
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.core import markdown, parse_ssl_cert
|
from superset.utils.core import markdown, parse_ssl_cert
|
||||||
|
|
||||||
database_schemas_query_schema = {
|
database_schemas_query_schema = {
|
||||||
|
@ -349,7 +349,7 @@ class DatabaseParametersSchemaMixin: # pylint: disable=too-few-public-methods
|
||||||
serialized_encrypted_extra = data.get("masked_encrypted_extra") or "{}"
|
serialized_encrypted_extra = data.get("masked_encrypted_extra") or "{}"
|
||||||
try:
|
try:
|
||||||
encrypted_extra = json.loads(serialized_encrypted_extra)
|
encrypted_extra = json.loads(serialized_encrypted_extra)
|
||||||
except json.decoder.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
encrypted_extra = {}
|
encrypted_extra = {}
|
||||||
|
|
||||||
data["sqlalchemy_uri"] = engine_spec.build_sqlalchemy_uri(
|
data["sqlalchemy_uri"] = engine_spec.build_sqlalchemy_uri(
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
# pylint: disable=too-many-lines
|
# pylint: disable=too-many-lines
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
@ -66,6 +65,7 @@ from superset.datasets.schemas import (
|
||||||
GetOrCreateDatasetSchema,
|
GetOrCreateDatasetSchema,
|
||||||
openapi_spec_methods_override,
|
openapi_spec_methods_override,
|
||||||
)
|
)
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.core import parse_boolean_string
|
from superset.utils.core import parse_boolean_string
|
||||||
from superset.views.base import DatasourceFilter
|
from superset.views.base import DatasourceFilter
|
||||||
from superset.views.base_api import (
|
from superset.views.base_api import (
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
@ -26,6 +25,7 @@ from marshmallow_sqlalchemy import SQLAlchemyAutoSchema
|
||||||
|
|
||||||
from superset.datasets.models import Dataset
|
from superset.datasets.models import Dataset
|
||||||
from superset.exceptions import SupersetMarshmallowValidationError
|
from superset.exceptions import SupersetMarshmallowValidationError
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
get_delete_ids_schema = {"type": "array", "items": {"type": "integer"}}
|
get_delete_ids_schema = {"type": "array", "items": {"type": "integer"}}
|
||||||
get_export_ids_schema = {"type": "array", "items": {"type": "integer"}}
|
get_export_ids_schema = {"type": "array", "items": {"type": "integer"}}
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
import warnings
|
import warnings
|
||||||
|
@ -72,7 +71,7 @@ from superset.superset_typing import (
|
||||||
ResultSetColumnType,
|
ResultSetColumnType,
|
||||||
SQLAColumnType,
|
SQLAColumnType,
|
||||||
)
|
)
|
||||||
from superset.utils import core as utils
|
from superset.utils import core as utils, json
|
||||||
from superset.utils.core import ColumnSpec, GenericDataType
|
from superset.utils.core import ColumnSpec, GenericDataType
|
||||||
from superset.utils.hashing import md5_sha_from_str
|
from superset.utils.hashing import md5_sha_from_str
|
||||||
from superset.utils.network import is_hostname_valid, is_port_open
|
from superset.utils.network import is_hostname_valid, is_port_open
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import json
|
|
||||||
import re
|
import re
|
||||||
import urllib
|
import urllib
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
@ -48,7 +47,7 @@ from superset.errors import SupersetError, SupersetErrorType
|
||||||
from superset.exceptions import SupersetException
|
from superset.exceptions import SupersetException
|
||||||
from superset.sql_parse import Table
|
from superset.sql_parse import Table
|
||||||
from superset.superset_typing import ResultSetColumnType
|
from superset.superset_typing import ResultSetColumnType
|
||||||
from superset.utils import core as utils
|
from superset.utils import core as utils, json
|
||||||
from superset.utils.hashing import md5_sha_from_str
|
from superset.utils.hashing import md5_sha_from_str
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any, TYPE_CHECKING, TypedDict, Union
|
from typing import Any, TYPE_CHECKING, TypedDict, Union
|
||||||
|
|
||||||
|
@ -33,6 +32,7 @@ from superset.databases.utils import make_url_safe
|
||||||
from superset.db_engine_specs.base import BaseEngineSpec, BasicParametersMixin
|
from superset.db_engine_specs.base import BaseEngineSpec, BasicParametersMixin
|
||||||
from superset.db_engine_specs.hive import HiveEngineSpec
|
from superset.db_engine_specs.hive import HiveEngineSpec
|
||||||
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
|
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.network import is_hostname_valid, is_port_open
|
from superset.utils.network import is_hostname_valid, is_port_open
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any, TYPE_CHECKING
|
from typing import Any, TYPE_CHECKING
|
||||||
|
@ -29,7 +28,7 @@ from superset.constants import TimeGrain
|
||||||
from superset.db_engine_specs.base import BaseEngineSpec
|
from superset.db_engine_specs.base import BaseEngineSpec
|
||||||
from superset.db_engine_specs.exceptions import SupersetDBAPIConnectionError
|
from superset.db_engine_specs.exceptions import SupersetDBAPIConnectionError
|
||||||
from superset.exceptions import SupersetException
|
from superset.exceptions import SupersetException
|
||||||
from superset.utils import core as utils
|
from superset.utils import core as utils, json
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from superset.connectors.sqla.models import TableColumn
|
from superset.connectors.sqla.models import TableColumn
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
from re import Pattern
|
from re import Pattern
|
||||||
|
@ -43,6 +42,7 @@ from superset.databases.schemas import encrypted_field_properties, EncryptedStri
|
||||||
from superset.db_engine_specs.shillelagh import ShillelaghEngineSpec
|
from superset.db_engine_specs.shillelagh import ShillelaghEngineSpec
|
||||||
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
|
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
|
||||||
from superset.exceptions import SupersetException
|
from superset.exceptions import SupersetException
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from superset.models.core import Database
|
from superset.models.core import Database
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
@ -37,7 +36,7 @@ from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
|
||||||
from superset.exceptions import SupersetException, SupersetSecurityException
|
from superset.exceptions import SupersetException, SupersetSecurityException
|
||||||
from superset.models.sql_lab import Query
|
from superset.models.sql_lab import Query
|
||||||
from superset.sql_parse import SQLScript
|
from superset.sql_parse import SQLScript
|
||||||
from superset.utils import core as utils
|
from superset.utils import core as utils, json
|
||||||
from superset.utils.core import GenericDataType
|
from superset.utils.core import GenericDataType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
|
|
@ -30,7 +30,6 @@ from typing import Any, cast, Optional, TYPE_CHECKING
|
||||||
from urllib import parse
|
from urllib import parse
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import simplejson as json
|
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
from flask_babel import gettext as __, lazy_gettext as _
|
from flask_babel import gettext as __, lazy_gettext as _
|
||||||
from packaging.version import Version
|
from packaging.version import Version
|
||||||
|
@ -60,7 +59,7 @@ from superset.models.sql_types.presto_sql_types import (
|
||||||
)
|
)
|
||||||
from superset.result_set import destringify
|
from superset.result_set import destringify
|
||||||
from superset.superset_typing import ResultSetColumnType
|
from superset.superset_typing import ResultSetColumnType
|
||||||
from superset.utils import core as utils
|
from superset.utils import core as utils, json
|
||||||
from superset.utils.core import GenericDataType
|
from superset.utils.core import GenericDataType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
@ -39,6 +38,7 @@ from superset.db_engine_specs.base import BaseEngineSpec, BasicPropertiesType
|
||||||
from superset.db_engine_specs.postgres import PostgresBaseEngineSpec
|
from superset.db_engine_specs.postgres import PostgresBaseEngineSpec
|
||||||
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
|
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
|
||||||
from superset.models.sql_lab import Query
|
from superset.models.sql_lab import Query
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from superset.models.core import Database
|
from superset.models.core import Database
|
||||||
|
|
|
@ -22,7 +22,6 @@ import threading
|
||||||
import time
|
import time
|
||||||
from typing import Any, TYPE_CHECKING
|
from typing import Any, TYPE_CHECKING
|
||||||
|
|
||||||
import simplejson as json
|
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
from sqlalchemy.engine.reflection import Inspector
|
from sqlalchemy.engine.reflection import Inspector
|
||||||
from sqlalchemy.engine.url import URL
|
from sqlalchemy.engine.url import URL
|
||||||
|
@ -42,7 +41,7 @@ from superset.db_engine_specs.presto import PrestoBaseEngineSpec
|
||||||
from superset.models.sql_lab import Query
|
from superset.models.sql_lab import Query
|
||||||
from superset.sql_parse import Table
|
from superset.sql_parse import Table
|
||||||
from superset.superset_typing import ResultSetColumnType
|
from superset.superset_typing import ResultSetColumnType
|
||||||
from superset.utils import core as utils
|
from superset.utils import core as utils, json
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from superset.models.core import Database
|
from superset.models.core import Database
|
||||||
|
|
|
@ -24,7 +24,7 @@ from flask_wtf.csrf import same_origin
|
||||||
from superset import event_logger, is_feature_enabled
|
from superset import event_logger, is_feature_enabled
|
||||||
from superset.daos.dashboard import EmbeddedDashboardDAO
|
from superset.daos.dashboard import EmbeddedDashboardDAO
|
||||||
from superset.superset_typing import FlaskResponse
|
from superset.superset_typing import FlaskResponse
|
||||||
from superset.utils import json as json_utils
|
from superset.utils import json
|
||||||
from superset.views.base import BaseSupersetView, common_bootstrap_payload
|
from superset.views.base import BaseSupersetView, common_bootstrap_payload
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class EmbeddedView(BaseSupersetView):
|
||||||
return self.render_template(
|
return self.render_template(
|
||||||
"superset/spa.html",
|
"superset/spa.html",
|
||||||
entry="embedded",
|
entry="embedded",
|
||||||
bootstrap_data=json_utils.dumps(
|
bootstrap_data=json.dumps(
|
||||||
bootstrap_data, default=json_utils.pessimistic_json_iso_dttm_ser
|
bootstrap_data, default=json.pessimistic_json_iso_dttm_ser
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import polyline
|
import polyline
|
||||||
|
@ -22,6 +21,7 @@ from sqlalchemy import inspect, String, Text
|
||||||
|
|
||||||
from superset import db
|
from superset import db
|
||||||
from superset.sql_parse import Table
|
from superset.sql_parse import Table
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
from ..utils.database import get_example_database
|
from ..utils.database import get_example_database
|
||||||
from .helpers import get_example_url, get_table_connector_registry
|
from .helpers import get_example_url, get_table_connector_registry
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
import textwrap
|
import textwrap
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
@ -28,6 +27,7 @@ from superset.models.core import Database
|
||||||
from superset.models.dashboard import Dashboard
|
from superset.models.dashboard import Dashboard
|
||||||
from superset.models.slice import Slice
|
from superset.models.slice import Slice
|
||||||
from superset.sql_parse import Table
|
from superset.sql_parse import Table
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.core import DatasourceType
|
from superset.utils.core import DatasourceType
|
||||||
|
|
||||||
from ..utils.database import get_example_database
|
from ..utils.database import get_example_database
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
|
|
||||||
from superset import db
|
from superset import db
|
||||||
from superset.models.dashboard import Dashboard
|
from superset.models.dashboard import Dashboard
|
||||||
from superset.models.slice import Slice
|
from superset.models.slice import Slice
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.core import DatasourceType
|
from superset.utils.core import DatasourceType
|
||||||
|
|
||||||
from .helpers import (
|
from .helpers import (
|
||||||
|
|
|
@ -16,13 +16,13 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
"""Loads datasets, dashboards and slices in a new superset instance"""
|
"""Loads datasets, dashboards and slices in a new superset instance"""
|
||||||
|
|
||||||
import json
|
|
||||||
import os
|
import os
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from superset import app, db
|
from superset import app, db
|
||||||
from superset.connectors.sqla.models import SqlaTable
|
from superset.connectors.sqla.models import SqlaTable
|
||||||
from superset.models.slice import Slice
|
from superset.models.slice import Slice
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
BASE_URL = "https://github.com/apache-superset/examples-data/blob/master/"
|
BASE_URL = "https://github.com/apache-superset/examples-data/blob/master/"
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
from superset import db
|
from superset import db
|
||||||
from superset.models.dashboard import Dashboard
|
from superset.models.dashboard import Dashboard
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
from .helpers import update_slice_ids
|
from .helpers import update_slice_ids
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from sqlalchemy import inspect, String, Text
|
from sqlalchemy import inspect, String, Text
|
||||||
|
@ -22,6 +21,7 @@ from sqlalchemy import inspect, String, Text
|
||||||
import superset.utils.database as database_utils
|
import superset.utils.database as database_utils
|
||||||
from superset import db
|
from superset import db
|
||||||
from superset.sql_parse import Table
|
from superset.sql_parse import Table
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
from .helpers import get_example_url, get_table_connector_registry
|
from .helpers import get_example_url, get_table_connector_registry
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from sqlalchemy import BigInteger, Float, inspect, Text
|
from sqlalchemy import BigInteger, Float, inspect, Text
|
||||||
|
@ -22,6 +21,7 @@ from sqlalchemy import BigInteger, Float, inspect, Text
|
||||||
import superset.utils.database as database_utils
|
import superset.utils.database as database_utils
|
||||||
from superset import db
|
from superset import db
|
||||||
from superset.sql_parse import Table
|
from superset.sql_parse import Table
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
from .helpers import get_example_url, get_table_connector_registry
|
from .helpers import get_example_url, get_table_connector_registry
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
# pylint: disable=too-many-lines
|
# pylint: disable=too-many-lines
|
||||||
|
|
||||||
import json
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
from sqlalchemy import inspect
|
from sqlalchemy import inspect
|
||||||
|
@ -27,6 +26,7 @@ from superset.connectors.sqla.models import SqlaTable
|
||||||
from superset.models.dashboard import Dashboard
|
from superset.models.dashboard import Dashboard
|
||||||
from superset.models.slice import Slice
|
from superset.models.slice import Slice
|
||||||
from superset.sql_parse import Table
|
from superset.sql_parse import Table
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.core import DatasourceType
|
from superset.utils.core import DatasourceType
|
||||||
|
|
||||||
from ..utils.database import get_example_database
|
from ..utils.database import get_example_database
|
||||||
|
|
|
@ -16,11 +16,11 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
"""Loads datasets, dashboards and slices in a new superset instance"""
|
"""Loads datasets, dashboards and slices in a new superset instance"""
|
||||||
|
|
||||||
import json
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
from superset import db
|
from superset import db
|
||||||
from superset.models.dashboard import Dashboard
|
from superset.models.dashboard import Dashboard
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
from .helpers import update_slice_ids
|
from .helpers import update_slice_ids
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
"""Loads datasets, dashboards and slices in a new superset instance"""
|
"""Loads datasets, dashboards and slices in a new superset instance"""
|
||||||
|
|
||||||
import json
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
@ -38,7 +37,7 @@ from superset.examples.helpers import (
|
||||||
from superset.models.dashboard import Dashboard
|
from superset.models.dashboard import Dashboard
|
||||||
from superset.models.slice import Slice
|
from superset.models.slice import Slice
|
||||||
from superset.sql_parse import Table
|
from superset.sql_parse import Table
|
||||||
from superset.utils import core as utils
|
from superset.utils import core as utils, json
|
||||||
from superset.utils.core import DatasourceType
|
from superset.utils.core import DatasourceType
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
import os
|
||||||
|
|
||||||
|
from astroid import nodes
|
||||||
|
from pylint.checkers import BaseChecker
|
||||||
|
from pylint.lint import PyLinter
|
||||||
|
|
||||||
|
|
||||||
|
class JSONLibraryImportChecker(BaseChecker):
|
||||||
|
name = "json-library-import-checker"
|
||||||
|
priority = -1
|
||||||
|
msgs = {
|
||||||
|
"C9999": (
|
||||||
|
"Disallowed json import used, use superset.utils.json instead",
|
||||||
|
"disallowed-import",
|
||||||
|
"Used when a disallowed import is used in a specific file.",
|
||||||
|
),
|
||||||
|
}
|
||||||
|
exclude_files = [
|
||||||
|
"setup.py",
|
||||||
|
"superset/utils/json.py",
|
||||||
|
"superset/config.py",
|
||||||
|
"superset/cli/update.py",
|
||||||
|
"superset/key_value/types.py",
|
||||||
|
"superset/translations/utils.py",
|
||||||
|
"superset/extensions/__init__.py",
|
||||||
|
]
|
||||||
|
path_strip_prefix = os.getcwd() + os.sep
|
||||||
|
|
||||||
|
def visit_import(self, node: nodes.Import) -> None:
|
||||||
|
file = (node.root().file).replace(self.path_strip_prefix, "", 1)
|
||||||
|
if file not in self.exclude_files:
|
||||||
|
for module_name, _ in node.names:
|
||||||
|
if module_name in ["json", "simplejson"]:
|
||||||
|
self.add_message("disallowed-import", node=node)
|
||||||
|
|
||||||
|
def visit_importfrom(self, node: nodes.ImportFrom) -> None:
|
||||||
|
file = (node.root().file).replace(self.path_strip_prefix, "", 1)
|
||||||
|
if file not in self.exclude_files:
|
||||||
|
if node.modname in ["json", "simplejson"]:
|
||||||
|
self.add_message("disallowed-import", node=node)
|
||||||
|
|
||||||
|
|
||||||
|
def register(linter: PyLinter) -> None:
|
||||||
|
linter.register_checker(JSONLibraryImportChecker(linter))
|
|
@ -16,12 +16,13 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
"""Contains the logic to create cohesive forms on the explore view"""
|
"""Contains the logic to create cohesive forms on the explore view"""
|
||||||
|
|
||||||
import json
|
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
from flask_appbuilder.fieldwidgets import BS3TextFieldWidget
|
from flask_appbuilder.fieldwidgets import BS3TextFieldWidget
|
||||||
from wtforms import Field
|
from wtforms import Field
|
||||||
|
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
|
|
||||||
class JsonListField(Field):
|
class JsonListField(Field):
|
||||||
widget = BS3TextFieldWidget()
|
widget = BS3TextFieldWidget()
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from zipfile import is_zipfile, ZipFile
|
from zipfile import is_zipfile, ZipFile
|
||||||
|
@ -30,6 +29,7 @@ from superset.commands.importers.exceptions import (
|
||||||
from superset.commands.importers.v1.assets import ImportAssetsCommand
|
from superset.commands.importers.v1.assets import ImportAssetsCommand
|
||||||
from superset.commands.importers.v1.utils import get_contents_from_bundle
|
from superset.commands.importers.v1.utils import get_contents_from_bundle
|
||||||
from superset.extensions import event_logger
|
from superset.extensions import event_logger
|
||||||
|
from superset.utils import json
|
||||||
from superset.views.base_api import BaseSupersetApi, requires_form_data, statsd_metrics
|
from superset.views.base_api import BaseSupersetApi, requires_form_data, statsd_metrics
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
"""Defines the templating context for SQL Lab"""
|
"""Defines the templating context for SQL Lab"""
|
||||||
|
|
||||||
import json
|
|
||||||
import re
|
import re
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from functools import lru_cache, partial
|
from functools import lru_cache, partial
|
||||||
|
@ -35,6 +34,7 @@ from superset.commands.dataset.exceptions import DatasetNotFoundError
|
||||||
from superset.constants import LRU_CACHE_MAX_SIZE
|
from superset.constants import LRU_CACHE_MAX_SIZE
|
||||||
from superset.exceptions import SupersetTemplateException
|
from superset.exceptions import SupersetTemplateException
|
||||||
from superset.extensions import feature_flag_manager
|
from superset.extensions import feature_flag_manager
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.core import (
|
from superset.utils.core import (
|
||||||
convert_legacy_filters_into_adhoc,
|
convert_legacy_filters_into_adhoc,
|
||||||
get_user_email,
|
get_user_email,
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
import json
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from sqlalchemy import and_, Column, Integer, String, Text
|
from sqlalchemy import and_, Column, Integer, String, Text
|
||||||
|
@ -27,6 +26,7 @@ from sqlalchemy.orm import Session
|
||||||
from superset import conf
|
from superset import conf
|
||||||
from superset.constants import TimeGrain
|
from superset.constants import TimeGrain
|
||||||
from superset.migrations.shared.utils import paginated_update, try_load_json
|
from superset.migrations.shared.utils import paginated_update, try_load_json
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@ -23,6 +22,7 @@ from shortid import ShortId
|
||||||
|
|
||||||
from superset.models.dashboard import Dashboard
|
from superset.models.dashboard import Dashboard
|
||||||
from superset.models.slice import Slice
|
from superset.models.slice import Slice
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.dashboard_filter_scopes_converter import convert_filter_scopes
|
from superset.utils.dashboard_filter_scopes_converter import convert_filter_scopes
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
@ -29,6 +28,8 @@ from sqlalchemy.dialects.postgresql.base import PGDialect
|
||||||
from sqlalchemy.exc import NoSuchTableError
|
from sqlalchemy.exc import NoSuchTableError
|
||||||
from sqlalchemy.orm import Query, Session
|
from sqlalchemy.orm import Query, Session
|
||||||
|
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
DEFAULT_BATCH_SIZE = int(os.environ.get("BATCH_SIZE", 1000))
|
DEFAULT_BATCH_SIZE = int(os.environ.get("BATCH_SIZE", 1000))
|
||||||
|
@ -164,6 +165,6 @@ def paginated_update(
|
||||||
def try_load_json(data: Optional[str]) -> dict[str, Any]:
|
def try_load_json(data: Optional[str]) -> dict[str, Any]:
|
||||||
try:
|
try:
|
||||||
return data and json.loads(data) or {}
|
return data and json.loads(data) or {}
|
||||||
except json.decoder.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
print(f"Failed to parse: {data}")
|
print(f"Failed to parse: {data}")
|
||||||
return {}
|
return {}
|
||||||
|
|
|
@ -26,13 +26,12 @@ Create Date: 2017-01-24 12:31:06.541746
|
||||||
revision = "db0c65b146bd"
|
revision = "db0c65b146bd"
|
||||||
down_revision = "f18570e03440"
|
down_revision = "f18570e03440"
|
||||||
|
|
||||||
import json # noqa: E402
|
|
||||||
|
|
||||||
from alembic import op # noqa: E402
|
from alembic import op # noqa: E402
|
||||||
from sqlalchemy import Column, Integer, String, Text # noqa: E402
|
from sqlalchemy import Column, Integer, String, Text # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db # noqa: E402
|
from superset import db # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ Create Date: 2017-02-08 14:16:34.948793
|
||||||
revision = "a99f2f7c195a"
|
revision = "a99f2f7c195a"
|
||||||
down_revision = "db0c65b146bd"
|
down_revision = "db0c65b146bd"
|
||||||
|
|
||||||
import json # noqa: E402
|
|
||||||
from urllib import parse # noqa: E402
|
from urllib import parse # noqa: E402
|
||||||
|
|
||||||
import sqlalchemy as sa # noqa: E402
|
import sqlalchemy as sa # noqa: E402
|
||||||
|
@ -34,6 +33,7 @@ from alembic import op # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db # noqa: E402
|
from superset import db # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
|
@ -22,13 +22,12 @@ Create Date: 2017-12-08 08:19:21.148775
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
from sqlalchemy import Column, Integer, String, Text
|
from sqlalchemy import Column, Integer, String, Text
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
|
|
||||||
from superset import db
|
from superset import db
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = "67a6ac9b727b"
|
revision = "67a6ac9b727b"
|
||||||
|
|
|
@ -22,13 +22,12 @@ Create Date: 2017-12-17 11:06:30.180267
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
from sqlalchemy import Column, Integer, or_, String, Text
|
from sqlalchemy import Column, Integer, or_, String, Text
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
|
|
||||||
from superset import db
|
from superset import db
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = "21e88bc06c02"
|
revision = "21e88bc06c02"
|
||||||
|
|
|
@ -21,13 +21,12 @@ Revises: 21e88bc06c02
|
||||||
Create Date: 2018-02-13 08:07:40.766277
|
Create Date: 2018-02-13 08:07:40.766277
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
|
||||||
|
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from alembic import op
|
from alembic import op
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
|
|
||||||
from superset import db
|
from superset import db
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
revision = "e866bd2d4976"
|
revision = "e866bd2d4976"
|
||||||
down_revision = "21e88bc06c02"
|
down_revision = "21e88bc06c02"
|
||||||
|
|
|
@ -22,13 +22,12 @@ Create Date: 2018-04-10 11:19:47.621878
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
from sqlalchemy import Column, Integer, String, Text
|
from sqlalchemy import Column, Integer, String, Text
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
|
|
||||||
from superset import db
|
from superset import db
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
|
@ -26,13 +26,12 @@ Create Date: 2018-06-04 11:12:59.878742
|
||||||
revision = "c5756bec8b47"
|
revision = "c5756bec8b47"
|
||||||
down_revision = "e502db2af7be"
|
down_revision = "e502db2af7be"
|
||||||
|
|
||||||
import json # noqa: E402
|
|
||||||
|
|
||||||
from alembic import op # noqa: E402
|
from alembic import op # noqa: E402
|
||||||
from sqlalchemy import Column, Integer, Text # noqa: E402
|
from sqlalchemy import Column, Integer, Text # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db # noqa: E402
|
from superset import db # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
|
@ -26,13 +26,12 @@ Create Date: 2018-06-07 09:52:54.535961
|
||||||
revision = "afb7730f6a9c"
|
revision = "afb7730f6a9c"
|
||||||
down_revision = "c5756bec8b47"
|
down_revision = "c5756bec8b47"
|
||||||
|
|
||||||
import json # noqa: E402
|
|
||||||
|
|
||||||
from alembic import op # noqa: E402
|
from alembic import op # noqa: E402
|
||||||
from sqlalchemy import Column, Integer, Text # noqa: E402
|
from sqlalchemy import Column, Integer, Text # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db # noqa: E402
|
from superset import db # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,6 @@ revision = "4451805bbaa1"
|
||||||
down_revision = "bddc498dd179"
|
down_revision = "bddc498dd179"
|
||||||
|
|
||||||
|
|
||||||
import json # noqa: E402
|
|
||||||
|
|
||||||
from alembic import op # noqa: E402
|
from alembic import op # noqa: E402
|
||||||
from sqlalchemy import ( # noqa: E402
|
from sqlalchemy import ( # noqa: E402
|
||||||
Column,
|
Column,
|
||||||
|
@ -41,6 +39,7 @@ from sqlalchemy import ( # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db # noqa: E402
|
from superset import db # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
|
@ -27,13 +27,12 @@ revision = "bddc498dd179"
|
||||||
down_revision = "80a67c5192fa"
|
down_revision = "80a67c5192fa"
|
||||||
|
|
||||||
|
|
||||||
import json # noqa: E402
|
|
||||||
|
|
||||||
from alembic import op # noqa: E402
|
from alembic import op # noqa: E402
|
||||||
from sqlalchemy import Column, Integer, Text # noqa: E402
|
from sqlalchemy import Column, Integer, Text # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db # noqa: E402
|
from superset import db # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
from superset.utils.core import ( # noqa: E402
|
from superset.utils.core import ( # noqa: E402
|
||||||
convert_legacy_filters_into_adhoc,
|
convert_legacy_filters_into_adhoc,
|
||||||
split_adhoc_filters_into_base_filters,
|
split_adhoc_filters_into_base_filters,
|
||||||
|
|
|
@ -27,13 +27,12 @@ revision = "80a67c5192fa"
|
||||||
down_revision = "afb7730f6a9c"
|
down_revision = "afb7730f6a9c"
|
||||||
|
|
||||||
|
|
||||||
import json # noqa: E402
|
|
||||||
|
|
||||||
from alembic import op # noqa: E402
|
from alembic import op # noqa: E402
|
||||||
from sqlalchemy import Column, Integer, String, Text # noqa: E402
|
from sqlalchemy import Column, Integer, String, Text # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db # noqa: E402
|
from superset import db # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ Create Date: 2018-07-05 15:19:14.609299
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import json
|
|
||||||
|
|
||||||
import isodate
|
import isodate
|
||||||
from alembic import op
|
from alembic import op
|
||||||
|
@ -33,6 +32,7 @@ from sqlalchemy import Column, Integer, String, Text
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
|
|
||||||
from superset import db
|
from superset import db
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.date_parser import parse_human_timedelta
|
from superset.utils.date_parser import parse_human_timedelta
|
||||||
|
|
||||||
revision = "3dda56f1c4c6"
|
revision = "3dda56f1c4c6"
|
||||||
|
|
|
@ -24,7 +24,6 @@ Create Date: 2018-07-22 11:59:07.025119
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
import collections
|
import collections
|
||||||
import json
|
|
||||||
import sys
|
import sys
|
||||||
import uuid
|
import uuid
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
|
@ -35,6 +34,7 @@ from sqlalchemy.ext.declarative import declarative_base
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
|
|
||||||
from superset import db
|
from superset import db
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
revision = "bebcf3fed1fe"
|
revision = "bebcf3fed1fe"
|
||||||
down_revision = "fc480c87706c"
|
down_revision = "fc480c87706c"
|
||||||
|
|
|
@ -23,7 +23,6 @@ Create Date: 2018-08-01 11:47:02.233971
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
import json
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
@ -31,6 +30,7 @@ from alembic import op
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
|
|
||||||
from superset import db
|
from superset import db
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
revision = "7fcdcde0761c"
|
revision = "7fcdcde0761c"
|
||||||
down_revision = "c18bd4186f15"
|
down_revision = "c18bd4186f15"
|
||||||
|
|
|
@ -23,13 +23,12 @@ Create Date: 2018-11-12 13:31:07.578090
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
import json
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
from sqlalchemy import Column, Integer, Text
|
from sqlalchemy import Column, Integer, Text
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
|
|
||||||
from superset import db
|
from superset import db
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
revision = "4ce8df208545"
|
revision = "4ce8df208545"
|
||||||
down_revision = "55e910a74826"
|
down_revision = "55e910a74826"
|
||||||
|
|
|
@ -22,7 +22,6 @@ Create Date: 2018-12-11 22:03:21.612516
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
|
@ -30,6 +29,7 @@ from sqlalchemy import Column, Integer, String, Text
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
|
|
||||||
from superset import db
|
from superset import db
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = "fb13d49b72f9"
|
revision = "fb13d49b72f9"
|
||||||
|
|
|
@ -22,7 +22,6 @@ Create Date: 2019-04-09 16:27:03.392872
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
|
@ -30,6 +29,7 @@ from sqlalchemy import Column, Integer, Text
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
|
|
||||||
from superset import db
|
from superset import db
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = "80aa3f04bc82"
|
revision = "80aa3f04bc82"
|
||||||
|
|
|
@ -26,7 +26,6 @@ Create Date: 2019-06-28 13:17:59.517089
|
||||||
revision = "ab8c66efdd01"
|
revision = "ab8c66efdd01"
|
||||||
down_revision = "d7c1a0d6f2da"
|
down_revision = "d7c1a0d6f2da"
|
||||||
|
|
||||||
import json # noqa: E402
|
|
||||||
import logging # noqa: E402
|
import logging # noqa: E402
|
||||||
|
|
||||||
from alembic import op # noqa: E402
|
from alembic import op # noqa: E402
|
||||||
|
@ -34,6 +33,7 @@ from sqlalchemy import Column, Integer, Text # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db # noqa: E402
|
from superset import db # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ Create Date: 2019-10-10 13:52:54.544475
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
|
@ -31,6 +30,7 @@ from sqlalchemy.ext.declarative import declarative_base
|
||||||
|
|
||||||
from superset import db
|
from superset import db
|
||||||
from superset.legacy import update_time_range
|
from superset.legacy import update_time_range
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = "1495eb914ad3"
|
revision = "1495eb914ad3"
|
||||||
|
|
|
@ -27,7 +27,6 @@ revision = "78ee127d0d1d"
|
||||||
down_revision = "c2acd2cf3df2"
|
down_revision = "c2acd2cf3df2"
|
||||||
|
|
||||||
import copy # noqa: E402
|
import copy # noqa: E402
|
||||||
import json # noqa: E402
|
|
||||||
import logging # noqa: E402
|
import logging # noqa: E402
|
||||||
|
|
||||||
from alembic import op # noqa: E402
|
from alembic import op # noqa: E402
|
||||||
|
@ -35,6 +34,7 @@ from sqlalchemy import Column, Integer, Text # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db # noqa: E402
|
from superset import db # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
from superset.utils.core import ( # noqa: E402
|
from superset.utils.core import ( # noqa: E402
|
||||||
convert_legacy_filters_into_adhoc,
|
convert_legacy_filters_into_adhoc,
|
||||||
)
|
)
|
||||||
|
|
|
@ -23,7 +23,6 @@ Create Date: 2020-02-07 14:13:51.714678
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
|
@ -32,6 +31,7 @@ from sqlalchemy.ext.declarative import declarative_base
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
|
|
||||||
from superset import db
|
from superset import db
|
||||||
|
from superset.utils import json
|
||||||
from superset.utils.dashboard_filter_scopes_converter import convert_filter_scopes
|
from superset.utils.dashboard_filter_scopes_converter import convert_filter_scopes
|
||||||
|
|
||||||
revision = "3325d4caccc8"
|
revision = "3325d4caccc8"
|
||||||
|
|
|
@ -26,13 +26,12 @@ Create Date: 2020-03-25 10:42:11.047328
|
||||||
revision = "f9a30386bd74"
|
revision = "f9a30386bd74"
|
||||||
down_revision = "b5998378c225"
|
down_revision = "b5998378c225"
|
||||||
|
|
||||||
import json # noqa: E402
|
|
||||||
|
|
||||||
from alembic import op # noqa: E402
|
from alembic import op # noqa: E402
|
||||||
from sqlalchemy import Column, Integer, String, Text # noqa: E402
|
from sqlalchemy import Column, Integer, String, Text # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db # noqa: E402
|
from superset import db # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
|
@ -26,14 +26,13 @@ Create Date: 2020-04-29 09:24:04.952368
|
||||||
revision = "620241d1153f"
|
revision = "620241d1153f"
|
||||||
down_revision = "f9a30386bd74"
|
down_revision = "f9a30386bd74"
|
||||||
|
|
||||||
import json # noqa: E402
|
|
||||||
|
|
||||||
from alembic import op # noqa: E402
|
from alembic import op # noqa: E402
|
||||||
from sqlalchemy import Column, ForeignKey, Integer, Text # noqa: E402
|
from sqlalchemy import Column, ForeignKey, Integer, Text # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db, db_engine_specs # noqa: E402
|
from superset import db, db_engine_specs # noqa: E402
|
||||||
from superset.databases.utils import make_url_safe # noqa: E402
|
from superset.databases.utils import make_url_safe # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ Create Date: 2020-08-12 00:24:39.617899
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import uuid
|
import uuid
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
@ -33,6 +32,7 @@ from sqlalchemy.ext.declarative import declarative_base
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
|
|
||||||
from superset import db
|
from superset import db
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = "978245563a02"
|
revision = "978245563a02"
|
||||||
|
|
|
@ -22,9 +22,7 @@ Create Date: 2020-09-28 17:57:23.128142
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
|
||||||
import os
|
import os
|
||||||
from json.decoder import JSONDecodeError
|
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
@ -35,7 +33,7 @@ from sqlalchemy_utils import UUIDType
|
||||||
|
|
||||||
from superset import db
|
from superset import db
|
||||||
from superset.migrations.shared.utils import assign_uuids
|
from superset.migrations.shared.utils import assign_uuids
|
||||||
from superset.utils import core as utils
|
from superset.utils import core as utils, json
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = "b56500de1855"
|
revision = "b56500de1855"
|
||||||
|
@ -81,7 +79,7 @@ default_batch_size = int(os.environ.get("BATCH_SIZE", 200))
|
||||||
def update_position_json(dashboard, session, uuid_map):
|
def update_position_json(dashboard, session, uuid_map):
|
||||||
try:
|
try:
|
||||||
layout = json.loads(dashboard.position_json or "{}")
|
layout = json.loads(dashboard.position_json or "{}")
|
||||||
except JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
layout = {}
|
layout = {}
|
||||||
|
|
||||||
for object_ in layout.values():
|
for object_ in layout.values():
|
||||||
|
|
|
@ -26,7 +26,6 @@ Create Date: 2021-01-23 16:25:14.496774
|
||||||
revision = "260bf0649a77"
|
revision = "260bf0649a77"
|
||||||
down_revision = "c878781977c6"
|
down_revision = "c878781977c6"
|
||||||
|
|
||||||
import json # noqa: E402
|
|
||||||
import re # noqa: E402
|
import re # noqa: E402
|
||||||
|
|
||||||
import sqlalchemy as sa # noqa: E402
|
import sqlalchemy as sa # noqa: E402
|
||||||
|
@ -38,6 +37,7 @@ from sqlalchemy.exc import OperationalError # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db # noqa: E402
|
from superset import db # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
from superset.utils.date_parser import DateRangeMigration # noqa: E402
|
from superset.utils.date_parser import DateRangeMigration # noqa: E402
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
|
@ -26,13 +26,12 @@ Create Date: 2021-02-04 09:34:13.608891
|
||||||
revision = "070c043f2fdb"
|
revision = "070c043f2fdb"
|
||||||
down_revision = "41ce8799acc3"
|
down_revision = "41ce8799acc3"
|
||||||
|
|
||||||
import json # noqa: E402
|
|
||||||
|
|
||||||
from alembic import op # noqa: E402
|
from alembic import op # noqa: E402
|
||||||
from sqlalchemy import and_, Boolean, Column, Integer, String, Text # noqa: E402
|
from sqlalchemy import and_, Boolean, Column, Integer, String, Text # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db # noqa: E402
|
from superset import db # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
|
@ -26,13 +26,12 @@ Create Date: 2021-02-10 12:32:27.385579
|
||||||
revision = "41ce8799acc3"
|
revision = "41ce8799acc3"
|
||||||
down_revision = "e11ccdd12658"
|
down_revision = "e11ccdd12658"
|
||||||
|
|
||||||
import json # noqa: E402
|
|
||||||
|
|
||||||
from alembic import op # noqa: E402
|
from alembic import op # noqa: E402
|
||||||
from sqlalchemy import and_, Column, Integer, String, Text # noqa: E402
|
from sqlalchemy import and_, Column, Integer, String, Text # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db # noqa: E402
|
from superset import db # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
|
@ -22,13 +22,12 @@ Create Date: 2021-02-14 11:46:02.379832
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
from sqlalchemy import Column, Integer, String, Text
|
from sqlalchemy import Column, Integer, String, Text
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
|
|
||||||
from superset import db
|
from superset import db
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = "1412ec1e5a7b"
|
revision = "1412ec1e5a7b"
|
||||||
|
|
|
@ -26,13 +26,12 @@ Create Date: 2021-03-24 09:47:21.569508
|
||||||
revision = "989bbe479899"
|
revision = "989bbe479899"
|
||||||
down_revision = "67da9ef1ef9c"
|
down_revision = "67da9ef1ef9c"
|
||||||
|
|
||||||
import json # noqa: E402
|
|
||||||
|
|
||||||
from alembic import op # noqa: E402
|
from alembic import op # noqa: E402
|
||||||
from sqlalchemy import Column, Integer, Text # noqa: E402
|
from sqlalchemy import Column, Integer, Text # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db # noqa: E402
|
from superset import db # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ Create Date: 2021-04-07 07:21:27.324983
|
||||||
revision = "134cea61c5e7"
|
revision = "134cea61c5e7"
|
||||||
down_revision = "301362411006"
|
down_revision = "301362411006"
|
||||||
|
|
||||||
import json # noqa: E402
|
|
||||||
import logging # noqa: E402
|
import logging # noqa: E402
|
||||||
|
|
||||||
from alembic import op # noqa: E402
|
from alembic import op # noqa: E402
|
||||||
|
@ -34,6 +33,7 @@ from sqlalchemy import Column, Integer, Text # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db # noqa: E402
|
from superset import db # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
|
@ -22,13 +22,12 @@ Create Date: 2021-04-09 16:14:19.040884
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
from sqlalchemy import Column, Integer, String, Text
|
from sqlalchemy import Column, Integer, String, Text
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
|
|
||||||
from superset import db
|
from superset import db
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = "085f06488938"
|
revision = "085f06488938"
|
||||||
|
|
|
@ -26,7 +26,6 @@ Create Date: 2021-04-12 12:38:03.913514
|
||||||
revision = "fc3a3a8ff221"
|
revision = "fc3a3a8ff221"
|
||||||
down_revision = "085f06488938"
|
down_revision = "085f06488938"
|
||||||
|
|
||||||
import json # noqa: E402
|
|
||||||
from collections.abc import Iterable # noqa: E402
|
from collections.abc import Iterable # noqa: E402
|
||||||
from typing import Any # noqa: E402
|
from typing import Any # noqa: E402
|
||||||
|
|
||||||
|
@ -35,6 +34,7 @@ from sqlalchemy import Column, Integer, Text # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db # noqa: E402
|
from superset import db # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ Create Date: 2021-04-29 15:32:21.939018
|
||||||
revision = "f1410ed7ec95"
|
revision = "f1410ed7ec95"
|
||||||
down_revision = "d416d0d715cc"
|
down_revision = "d416d0d715cc"
|
||||||
|
|
||||||
import json # noqa: E402
|
|
||||||
from collections.abc import Iterable # noqa: E402
|
from collections.abc import Iterable # noqa: E402
|
||||||
from typing import Any # noqa: E402
|
from typing import Any # noqa: E402
|
||||||
|
|
||||||
|
@ -35,6 +34,7 @@ from sqlalchemy import Column, Integer, Text # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db # noqa: E402
|
from superset import db # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ Create Date: 2021-08-02 16:39:45.329151
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
|
@ -30,6 +29,7 @@ from sqlalchemy import Column, Integer, Text
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
|
|
||||||
from superset import db
|
from superset import db
|
||||||
|
from superset.utils import json
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = "e323605f370a"
|
revision = "e323605f370a"
|
||||||
|
@ -55,7 +55,7 @@ def upgrade():
|
||||||
for database in session.query(Database).all():
|
for database in session.query(Database).all():
|
||||||
try:
|
try:
|
||||||
extra = json.loads(database.extra)
|
extra = json.loads(database.extra)
|
||||||
except json.decoder.JSONDecodeError as ex:
|
except json.JSONDecodeError as ex:
|
||||||
logging.warning(str(ex))
|
logging.warning(str(ex))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
|
@ -26,13 +26,12 @@ Create Date: 2021-08-03 15:36:35.925420
|
||||||
revision = "143b6f2815da"
|
revision = "143b6f2815da"
|
||||||
down_revision = "e323605f370a"
|
down_revision = "e323605f370a"
|
||||||
|
|
||||||
import json # noqa: E402
|
|
||||||
|
|
||||||
from alembic import op # noqa: E402
|
from alembic import op # noqa: E402
|
||||||
from sqlalchemy import and_, Column, Integer, String, Text # noqa: E402
|
from sqlalchemy import and_, Column, Integer, String, Text # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db # noqa: E402
|
from superset import db # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ Create Date: 2021-08-31 11:37:40.604081
|
||||||
revision = "021b81fe4fbb"
|
revision = "021b81fe4fbb"
|
||||||
down_revision = "07071313dd52"
|
down_revision = "07071313dd52"
|
||||||
|
|
||||||
import json # noqa: E402
|
|
||||||
import logging # noqa: E402
|
import logging # noqa: E402
|
||||||
|
|
||||||
import sqlalchemy as sa # noqa: E402
|
import sqlalchemy as sa # noqa: E402
|
||||||
|
@ -34,6 +33,7 @@ from alembic import op # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db # noqa: E402
|
from superset import db # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
|
@ -26,13 +26,12 @@ Create Date: 2021-09-27 11:31:53.453164
|
||||||
revision = "60dc453f4e2e"
|
revision = "60dc453f4e2e"
|
||||||
down_revision = "3ebe0993c770"
|
down_revision = "3ebe0993c770"
|
||||||
|
|
||||||
import json # noqa: E402
|
|
||||||
|
|
||||||
from alembic import op # noqa: E402
|
from alembic import op # noqa: E402
|
||||||
from sqlalchemy import and_, Column, Integer, String, Text # noqa: E402
|
from sqlalchemy import and_, Column, Integer, String, Text # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db # noqa: E402
|
from superset import db # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
|
@ -26,13 +26,12 @@ Create Date: 2021-10-12 11:15:25.559532
|
||||||
revision = "32646df09c64"
|
revision = "32646df09c64"
|
||||||
down_revision = "60dc453f4e2e"
|
down_revision = "60dc453f4e2e"
|
||||||
|
|
||||||
import json # noqa: E402
|
|
||||||
|
|
||||||
from alembic import op # noqa: E402
|
from alembic import op # noqa: E402
|
||||||
from sqlalchemy import Column, Integer, Text # noqa: E402
|
from sqlalchemy import Column, Integer, Text # noqa: E402
|
||||||
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
from sqlalchemy.ext.declarative import declarative_base # noqa: E402
|
||||||
|
|
||||||
from superset import db # noqa: E402
|
from superset import db # noqa: E402
|
||||||
|
from superset.utils import json # noqa: E402
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue