Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ingest/fivetran): use emails in owner user urns #10229

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ class Constant:
TIME_STAMP = "time_stamp"
STATUS = "status"
USER_ID = "user_id"
GIVEN_NAME = "given_name"
FAMILY_NAME = "family_name"
EMAIL = "email"
CONNECTOR_ID = "connector_id"
CONNECTOR_NAME = "connector_name"
CONNECTOR_TYPE_ID = "connector_type_id"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Connector:
paused: bool
sync_frequency: int
destination_id: str
user_name: Optional[str]
user_email: Optional[str]
table_lineage: List[TableLineage]
jobs: List["Job"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def _generate_datajob_from_connector(self, connector: Connector) -> DataJob:
id=connector.connector_id,
flow_urn=dataflow_urn,
name=connector.connector_name,
owners={connector.user_name} if connector.user_name else set(),
owners={connector.user_email} if connector.user_email else set(),
)

job_property_bag: Dict[str, str] = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def _get_jobs_list(self, connector_id: str) -> List[Job]:
)
return jobs

def _get_user_name(self, user_id: Optional[str]) -> Optional[str]:
def _get_user_email(self, user_id: Optional[str]) -> Optional[str]:
if not user_id:
return None
user_details = self._query(
Expand All @@ -166,7 +166,7 @@ def _get_user_name(self, user_id: Optional[str]) -> Optional[str]:
if not user_details:
return None

return f"{user_details[0][Constant.GIVEN_NAME]} {user_details[0][Constant.FAMILY_NAME]}"
return f"{user_details[0][Constant.EMAIL]}"

def get_allowed_connectors_list(
self, connector_patterns: AllowDenyPattern, report: FivetranSourceReport
Expand All @@ -185,7 +185,7 @@ def get_allowed_connectors_list(
paused=connector[Constant.PAUSED],
sync_frequency=connector[Constant.SYNC_FREQUENCY],
destination_id=connector[Constant.DESTINATION_ID],
user_name=self._get_user_name(
user_email=self._get_user_email(
connector[Constant.CONNECTING_USER_ID]
),
table_lineage=self._get_table_lineage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def get_user_query(self, user_id: str) -> str:
return f"""
SELECT id as user_id,
given_name,
family_name
family_name,
email
FROM {self.db_clause}user
WHERE id = '{user_id}'"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"aspect": {
"json": {
"owners": [],
"ownerTypes": {},
"lastModified": {
"time": 0,
"actor": "urn:li:corpuser:fivetran"
Expand Down Expand Up @@ -187,13 +188,14 @@
"json": {
"owners": [
{
"owner": "urn:li:corpuser:Shubham Jagtap",
"owner": "urn:li:corpuser:abc.xyz@email.com",
"type": "DEVELOPER",
"source": {
"type": "SERVICE"
}
}
],
"ownerTypes": {},
"lastModified": {
"time": 0,
"actor": "urn:li:corpuser:fivetran"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"aspect": {
"json": {
"owners": [],
"ownerTypes": {},
"lastModified": {
"time": 0,
"actor": "urn:li:corpuser:fivetran"
Expand Down Expand Up @@ -187,13 +188,14 @@
"json": {
"owners": [
{
"owner": "urn:li:corpuser:Shubham Jagtap",
"owner": "urn:li:corpuser:abc.xyz@email.com",
"type": "DEVELOPER",
"source": {
"type": "SERVICE"
}
}
],
"ownerTypes": {},
"lastModified": {
"time": 0,
"actor": "urn:li:corpuser:fivetran"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def default_query_results(
"user_id": "reapply_phone",
"given_name": "Shubham",
"family_name": "Jagtap",
"email": "abc.xyz@email.com",
}
]
elif query == fivetran_log_query.get_sync_start_logs_query("calendar_elected"):
Expand Down
Loading