From e6e8276a203151d979c1a86b2f9364aac9463bb1 Mon Sep 17 00:00:00 2001 From: "Hugh A. Miles II" Date: Mon, 10 Jul 2023 12:55:11 -0400 Subject: [PATCH] fix: fix extra insert for count on dataset creation (#24625) --- superset/datasets/commands/create.py | 5 +---- superset/utils/pandas_postprocessing/prophet.py | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/superset/datasets/commands/create.py b/superset/datasets/commands/create.py index 6349aa6bd..71b283436 100644 --- a/superset/datasets/commands/create.py +++ b/superset/datasets/commands/create.py @@ -22,7 +22,6 @@ from marshmallow import ValidationError from sqlalchemy.exc import SQLAlchemyError from superset.commands.base import BaseCommand, CreateMixin -from superset.connectors.sqla.models import SqlMetric from superset.daos.dataset import DatasetDAO from superset.daos.exceptions import DAOCreateFailedError from superset.datasets.commands.exceptions import ( @@ -47,9 +46,7 @@ class CreateDatasetCommand(CreateMixin, BaseCommand): # Creates SqlaTable (Dataset) dataset = DatasetDAO.create(self._properties, commit=False) - # Updates columns and metrics from the dataset - dataset.metrics = [SqlMetric(metric_name="COUNT(*)", expression="COUNT(*)")] - + # Updates columns and metrics from the datase dataset.fetch_metadata(commit=False) db.session.commit() except (SQLAlchemyError, DAOCreateFailedError) as ex: diff --git a/superset/utils/pandas_postprocessing/prophet.py b/superset/utils/pandas_postprocessing/prophet.py index a23f7838b..47d956fed 100644 --- a/superset/utils/pandas_postprocessing/prophet.py +++ b/superset/utils/pandas_postprocessing/prophet.py @@ -52,7 +52,7 @@ def _prophet_fit_and_predict( # pylint: disable=too-many-arguments Fit a prophet model and return a DataFrame with predicted results. """ try: - # pylint: disable=import-error,import-outside-toplevel + # pylint: disable=import-outside-toplevel from prophet import Prophet prophet_logger = logging.getLogger("prophet.plot")