mirror of
https://github.com/apache/superset.git
synced 2026-04-24 18:44:53 +00:00
chore: switching out ConnectorRegistry references for DatasourceDAO (#20380)
* rename and move dao file * Update dao.py * add cachekey * Update __init__.py * change reference in query context test * add utils ref * more ref changes * add helpers * add todo in dashboard.py * add cachekey * circular import error in dar.py * push rest of refs * fix linting * fix more linting * update enum * remove references for connector registry * big reafctor * take value * fix * test to see if removing value works * delete connectregistry * address concerns * address comments * fix merge conflicts * address concern II * address concern II * fix test Co-authored-by: Phillip Kelley-Dotson <pkelleydotson@yahoo.com>
This commit is contained in:
@@ -26,10 +26,15 @@ from superset.charts.schemas import ChartDataQueryContextSchema
|
||||
from superset.common.chart_data import ChartDataResultFormat, ChartDataResultType
|
||||
from superset.common.query_context import QueryContext
|
||||
from superset.common.query_object import QueryObject
|
||||
from superset.connectors.connector_registry import ConnectorRegistry
|
||||
from superset.connectors.sqla.models import SqlMetric
|
||||
from superset.datasource.dao import DatasourceDAO
|
||||
from superset.extensions import cache_manager
|
||||
from superset.utils.core import AdhocMetricExpressionType, backend, QueryStatus
|
||||
from superset.utils.core import (
|
||||
AdhocMetricExpressionType,
|
||||
backend,
|
||||
DatasourceType,
|
||||
QueryStatus,
|
||||
)
|
||||
from tests.integration_tests.base_tests import SupersetTestCase
|
||||
from tests.integration_tests.fixtures.birth_names_dashboard import (
|
||||
load_birth_names_dashboard_with_slices,
|
||||
@@ -132,10 +137,10 @@ class TestQueryContext(SupersetTestCase):
|
||||
cache_key_original = query_context.query_cache_key(query_object)
|
||||
|
||||
# make temporary change and revert it to refresh the changed_on property
|
||||
datasource = ConnectorRegistry.get_datasource(
|
||||
datasource_type=payload["datasource"]["type"],
|
||||
datasource_id=payload["datasource"]["id"],
|
||||
datasource = DatasourceDAO.get_datasource(
|
||||
session=db.session,
|
||||
datasource_type=DatasourceType(payload["datasource"]["type"]),
|
||||
datasource_id=payload["datasource"]["id"],
|
||||
)
|
||||
description_original = datasource.description
|
||||
datasource.description = "temporary description"
|
||||
@@ -156,10 +161,10 @@ class TestQueryContext(SupersetTestCase):
|
||||
payload = get_query_context("birth_names")
|
||||
|
||||
# make temporary change and revert it to refresh the changed_on property
|
||||
datasource = ConnectorRegistry.get_datasource(
|
||||
datasource_type=payload["datasource"]["type"],
|
||||
datasource_id=payload["datasource"]["id"],
|
||||
datasource = DatasourceDAO.get_datasource(
|
||||
session=db.session,
|
||||
datasource_type=DatasourceType(payload["datasource"]["type"]),
|
||||
datasource_id=payload["datasource"]["id"],
|
||||
)
|
||||
|
||||
datasource.metrics.append(SqlMetric(metric_name="foo", expression="select 1;"))
|
||||
|
||||
Reference in New Issue
Block a user