fix: fix extra insert for count on dataset creation (#24625)
This commit is contained in:
parent
fe2c14ff3a
commit
e6e8276a20
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Reference in New Issue