OpenMetadata/ingestion/tests/unit/utils/test_service_spec.py
Imri Paran 95982b9395
[GEN-356] Use ServiceSpec for loading sources based on connectors (#18322)
* ref(profiler): use di for system profile

- use source classes that can be overridden in system profiles
- use a manifest class instead of factory to specify which class to resolve for connectors
- example usage can be seen in redshift and snowflake

* - added manifests for all custom profilers
- used super() dependency injection in order for system metrics source
- formatting

* - implement spec for all source types
- added docs for the new specification
- added some pylint ignores in the importer module

* remove TYPE_CHECKING in core.py

* - deleted valuedispatch function
- deleted get_system_metrics_by_dialect
- implemented BigQueryProfiler with a system metrics source
- moved import_source_class to BaseSpec

* - removed tests related to the profiler factory

* - reverted start_time
- removed DML_STAT_TO_DML_STATEMENT_MAPPING
- removed unused logger

* - reverted start_time
- removed DML_STAT_TO_DML_STATEMENT_MAPPING
- removed unused logger

* fixed tests

* format

* bigquery system profile e2e tests

* fixed module docstring

* - removed import_side_effects from redshift. we still use it in postgres for the orm conversion maps.
- removed leftover methods

* - tests for BaseSpec
- moved get_class_path to importer

* - moved constructors around to get rid of useless kwargs

* - changed test_system_metric

* - added linage and usage to service_spec
- fixed postgres native lineage test

* add comments on collaborative constructors
2024-10-24 07:47:50 +02:00

17 lines
700 B
Python

from metadata.ingestion.source.database.mysql.metadata import MysqlSource
from metadata.profiler.interface.sqlalchemy.profiler_interface import (
SQAProfilerInterface,
)
from metadata.utils.importer import get_class_path
from metadata.utils.service_spec import BaseSpec
from metadata.utils.service_spec.default import DefaultDatabaseSpec
def test_service_spec():
spec = BaseSpec(metadata_source_class=MysqlSource)
assert spec.metadata_source_class == get_class_path(MysqlSource)
spec = DefaultDatabaseSpec(metadata_source_class=MysqlSource)
assert spec.metadata_source_class == get_class_path(MysqlSource)
assert spec.profiler_class == get_class_path(SQAProfilerInterface)