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:
Hugh A. Miles II
2022-06-21 13:22:39 +02:00
committed by GitHub
parent c79b0d62d0
commit e3e37cb68f
34 changed files with 334 additions and 504 deletions

View File

@@ -28,10 +28,11 @@ import prison
import pytest
from flask import current_app
from superset.datasource.dao import DatasourceDAO
from superset.models.dashboard import Dashboard
from superset import app, appbuilder, db, security_manager, viz, ConnectorRegistry
from superset import app, appbuilder, db, security_manager, viz
from superset.connectors.sqla.models import SqlaTable
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
from superset.exceptions import SupersetSecurityException
@@ -990,7 +991,7 @@ class TestDatasources(SupersetTestCase):
mock_get_session.query.return_value.filter.return_value.all.return_value = []
with mock.patch.object(
ConnectorRegistry, "get_all_datasources"
SqlaTable, "get_all_datasources"
) as mock_get_all_datasources:
mock_get_all_datasources.return_value = [
Datasource("database1", "schema1", "table1"),
@@ -1018,7 +1019,7 @@ class TestDatasources(SupersetTestCase):
mock_get_session.query.return_value.filter.return_value.all.return_value = []
with mock.patch.object(
ConnectorRegistry, "get_all_datasources"
SqlaTable, "get_all_datasources"
) as mock_get_all_datasources:
mock_get_all_datasources.return_value = [
Datasource("database1", "schema1", "table1"),
@@ -1046,7 +1047,7 @@ class TestDatasources(SupersetTestCase):
]
with mock.patch.object(
ConnectorRegistry, "get_all_datasources"
SqlaTable, "get_all_datasources"
) as mock_get_all_datasources:
mock_get_all_datasources.return_value = [
Datasource("database1", "schema1", "table1"),