2022-03-07 13:14:29 -08:00
|
|
|
from typing import Iterable
|
|
|
|
|
|
|
|
from datahub.emitter.mcp import MetadataChangeProposalWrapper
|
2023-05-17 00:01:57 -04:00
|
|
|
from datahub.ingestion.api.common import PipelineContext
|
2022-03-07 13:14:29 -08:00
|
|
|
from datahub.ingestion.api.source import Source, SourceReport
|
2023-05-17 00:01:57 -04:00
|
|
|
from datahub.ingestion.api.workunit import MetadataWorkUnit
|
2023-01-04 23:29:56 -05:00
|
|
|
from datahub.metadata.schema_classes import StatusClass
|
2022-03-07 13:14:29 -08:00
|
|
|
from datahub.utilities.urns.dataset_urn import DatasetUrn
|
|
|
|
|
|
|
|
|
2022-05-26 12:39:40 -04:00
|
|
|
class FakeSource(Source):
|
2023-05-24 16:36:19 -04:00
|
|
|
def get_workunits_internal(self) -> Iterable[MetadataWorkUnit]:
|
2022-03-07 13:14:29 -08:00
|
|
|
return [
|
2023-05-17 00:01:57 -04:00
|
|
|
MetadataWorkUnit(
|
2022-03-07 13:14:29 -08:00
|
|
|
id="test-workunit",
|
|
|
|
mcp=MetadataChangeProposalWrapper(
|
|
|
|
entityUrn=str(
|
|
|
|
DatasetUrn.create_from_ids(
|
|
|
|
platform_id="elasticsearch",
|
|
|
|
table_name="fooIndex",
|
|
|
|
env="PROD",
|
|
|
|
)
|
|
|
|
),
|
|
|
|
aspect=StatusClass(removed=False),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
]
|
|
|
|
|
|
|
|
def __init__(self, ctx: PipelineContext):
|
|
|
|
self.source_report = SourceReport()
|
|
|
|
|
|
|
|
@classmethod
|
2022-05-26 12:39:40 -04:00
|
|
|
def create(cls, config_dict: dict, ctx: PipelineContext) -> "FakeSource":
|
|
|
|
return FakeSource(ctx)
|
2022-03-07 13:14:29 -08:00
|
|
|
|
|
|
|
def get_report(self) -> SourceReport:
|
|
|
|
return self.source_report
|
|
|
|
|
|
|
|
def close(self) -> None:
|
|
|
|
return super().close()
|