diff --git a/lib/dl_connector_metrica/dl_connector_metrica/core/data_source.py b/lib/dl_connector_metrica/dl_connector_metrica/core/data_source.py index 17221965b..4c0c4b95f 100644 --- a/lib/dl_connector_metrica/dl_connector_metrica/core/data_source.py +++ b/lib/dl_connector_metrica/dl_connector_metrica/core/data_source.py @@ -11,7 +11,10 @@ Tuple, ) -from dl_constants.enums import UserDataType +from dl_constants.enums import ( + DataSourceType, + UserDataType, +) from dl_core import exc from dl_core.data_source.sql import PseudoSQLDataSource from dl_core.db import ( @@ -22,6 +25,8 @@ from dl_connector_metrica.core.constants import ( CONNECTION_TYPE_APPMETRICA_API, CONNECTION_TYPE_METRICA_API, + SOURCE_TYPE_APPMETRICA_API, + SOURCE_TYPE_METRICA_API, ) from dl_connector_metrica.core.us_connection import MetrikaApiConnection @@ -88,6 +93,14 @@ def get_expression_value_range(self, col_name: str) -> Tuple[Any, Any]: return min_value, max_value + @classmethod + def is_compatible_with_type(cls, source_type: DataSourceType) -> bool: + return source_type == SOURCE_TYPE_METRICA_API + class AppMetrikaApiDataSource(MetrikaApiDataSource): conn_type = CONNECTION_TYPE_APPMETRICA_API + + @classmethod + def is_compatible_with_type(cls, source_type: DataSourceType) -> bool: + return source_type == SOURCE_TYPE_APPMETRICA_API diff --git a/lib/dl_connector_metrica/dl_connector_metrica_tests/ext/core/test_dataset.py b/lib/dl_connector_metrica/dl_connector_metrica_tests/ext/core/test_dataset.py index e4bb24b4b..48ec4000d 100644 --- a/lib/dl_connector_metrica/dl_connector_metrica_tests/ext/core/test_dataset.py +++ b/lib/dl_connector_metrica/dl_connector_metrica_tests/ext/core/test_dataset.py @@ -1,10 +1,14 @@ -from typing import Optional +from typing import ( + AbstractSet, + Optional, +) import pytest import sqlalchemy as sa from dl_constants.enums import ( DataSourceRole, + JoinType, UserDataType, ) from dl_core.dataset_capabilities import DatasetCapabilities @@ -232,6 +236,12 @@ def test_source_cannot_be_added( finally: sync_us_manager.delete(testing_conn) + def _check_supported_join_types(self, supp_join_types: AbstractSet[JoinType]) -> None: + assert not supp_join_types + + def _allow_adding_sources(self, dataset: Dataset) -> bool: + return False + class TestAppMetricaDataset(BaseAppMetricaTestClass, DefaultDatasetTestSuite[AppMetricaApiConnection]): source_type = SOURCE_TYPE_APPMETRICA_API @@ -245,6 +255,12 @@ class TestAppMetricaDataset(BaseAppMetricaTestClass, DefaultDatasetTestSuite[App }, ) + def _check_supported_join_types(self, supp_join_types: AbstractSet[JoinType]) -> None: + assert not supp_join_types + + def _allow_adding_sources(self, dataset: Dataset) -> bool: + return False + @pytest.fixture(scope="function") def dsrc_params(self) -> dict: return dict(