-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into kafka-sink-errors
- Loading branch information
Showing
12 changed files
with
205 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.versionNavItem { | ||
margin-left: 0 !important; | ||
padding: 0.2em 1em !important; | ||
display: block; | ||
border-radius: var(--ifm-button-border-radius) !important; | ||
color: var(--ifm-menu-color-active); | ||
background: var(--ifm-menu-color-background-active); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
metadata-ingestion/src/datahub/ingestion/source/datahub/datahub_api_reader.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import logging | ||
from concurrent import futures | ||
from typing import Dict, Iterable, List | ||
|
||
from datahub.emitter.mcp import MetadataChangeProposalWrapper | ||
from datahub.ingestion.graph.client import DataHubGraph | ||
from datahub.ingestion.graph.filters import RemovedStatusFilter | ||
from datahub.ingestion.source.datahub.config import DataHubSourceConfig | ||
from datahub.ingestion.source.datahub.report import DataHubSourceReport | ||
from datahub.metadata._schema_classes import _Aspect | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
# Should work for at least mysql, mariadb, postgres | ||
DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S.%f" | ||
|
||
|
||
class DataHubApiReader: | ||
def __init__( | ||
self, | ||
config: DataHubSourceConfig, | ||
report: DataHubSourceReport, | ||
graph: DataHubGraph, | ||
): | ||
self.config = config | ||
self.report = report | ||
self.graph = graph | ||
|
||
def get_aspects(self) -> Iterable[MetadataChangeProposalWrapper]: | ||
urns = self.graph.get_urns_by_filter( | ||
status=RemovedStatusFilter.ALL, | ||
batch_size=self.config.database_query_batch_size, | ||
) | ||
tasks: List[futures.Future[Iterable[MetadataChangeProposalWrapper]]] = [] | ||
with futures.ThreadPoolExecutor( | ||
max_workers=self.config.max_workers | ||
) as executor: | ||
for urn in urns: | ||
tasks.append(executor.submit(self._get_aspects_for_urn, urn)) | ||
for task in futures.as_completed(tasks): | ||
yield from task.result() | ||
|
||
def _get_aspects_for_urn(self, urn: str) -> Iterable[MetadataChangeProposalWrapper]: | ||
aspects: Dict[str, _Aspect] = self.graph.get_entity_semityped(urn) # type: ignore | ||
for aspect in aspects.values(): | ||
yield MetadataChangeProposalWrapper( | ||
entityUrn=urn, | ||
aspect=aspect, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.