Skip to content

Commit c804b3c

Browse files
ryaminalhsheth2
andauthored
fix(ingest/fivetran): handle missing user_id for a connection (datahub-project#9460)
Co-authored-by: Harshal Sheth <[email protected]>
1 parent 19f104a commit c804b3c

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

metadata-ingestion/src/datahub/ingestion/source/fivetran/data_classes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from dataclasses import dataclass
2-
from typing import List
2+
from typing import List, Optional
33

44

55
@dataclass
@@ -23,7 +23,7 @@ class Connector:
2323
paused: bool
2424
sync_frequency: int
2525
destination_id: str
26-
user_name: str
26+
user_name: Optional[str]
2727
table_lineage: List[TableLineage]
2828
jobs: List["Job"]
2929

metadata-ingestion/src/datahub/ingestion/source/fivetran/fivetran.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def _generate_datajob_from_connector(self, connector: Connector) -> DataJob:
179179
id=connector.connector_id,
180180
flow_urn=dataflow_urn,
181181
name=connector.connector_name,
182-
owners={connector.user_name},
182+
owners={connector.user_name} if connector.user_name else set(),
183183
)
184184

185185
job_property_bag: Dict[str, str] = {}

metadata-ingestion/src/datahub/ingestion/source/fivetran/fivetran_log_api.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ def _get_jobs_list(self, connector_id: str) -> List[Job]:
117117
)
118118
return jobs
119119

120-
def _get_user_name(self, user_id: str) -> str:
120+
def _get_user_name(self, user_id: Optional[str]) -> Optional[str]:
121+
if not user_id:
122+
return None
121123
user_details = self._query(FivetranLogQuery.get_user_query(user_id=user_id))[0]
122124
return (
123125
f"{user_details[Constant.GIVEN_NAME]} {user_details[Constant.FAMILY_NAME]}"

0 commit comments

Comments
 (0)