fix(ingest/bigquery): use email as user urn (#13831)

This commit is contained in:
Aseem Bansal 2025-06-20 18:45:41 +05:30 committed by GitHub
parent dbcbca9a38
commit b3a25d6fbd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 13 deletions

View File

@ -63,7 +63,7 @@ class BigQueryIdentifierBuilder:
) )
def gen_user_urn(self, user_email: str) -> str: def gen_user_urn(self, user_email: str) -> str:
return make_user_urn(user_email.split("@")[0]) return make_user_urn(user_email)
def make_data_platform_urn(self) -> str: def make_data_platform_urn(self) -> str:
return make_data_platform_urn(self.platform) return make_data_platform_urn(self.platform)

View File

@ -14,7 +14,7 @@
}, },
"created": { "created": {
"time": 1643871600000, "time": 1643871600000,
"actor": "urn:li:corpuser:foo" "actor": "urn:li:corpuser:foo@xyz.com"
}, },
"dataset": "urn:li:dataset:(urn:li:dataPlatform:bigquery,project-id-1.bigquery-dataset-1.table-1,PROD)", "dataset": "urn:li:dataset:(urn:li:dataPlatform:bigquery,project-id-1.bigquery-dataset-1.table-1,PROD)",
"type": "TRANSFORMED", "type": "TRANSFORMED",
@ -25,7 +25,7 @@
}, },
"systemMetadata": { "systemMetadata": {
"lastObserved": 1643871600000, "lastObserved": 1643871600000,
"runId": "bigquery-2022_02_03-07_00_00-6mhnuz", "runId": "bigquery-2022_02_03-07_00_00-pj1cgp",
"lastRunId": "no-run-id-provided" "lastRunId": "no-run-id-provided"
} }
}, },
@ -117,7 +117,7 @@
"uniqueUserCount": 1, "uniqueUserCount": 1,
"userCounts": [ "userCounts": [
{ {
"user": "urn:li:corpuser:foo", "user": "urn:li:corpuser:foo@xyz.com",
"count": 2 "count": 2
} }
] ]
@ -125,7 +125,7 @@
}, },
"systemMetadata": { "systemMetadata": {
"lastObserved": 1643871600000, "lastObserved": 1643871600000,
"runId": "bigquery-2022_02_03-07_00_00-6mhnuz", "runId": "bigquery-2022_02_03-07_00_00-pj1cgp",
"lastRunId": "no-run-id-provided" "lastRunId": "no-run-id-provided"
} }
}, },
@ -153,8 +153,9 @@
], ],
"userCounts": [ "userCounts": [
{ {
"user": "urn:li:corpuser:foo", "user": "urn:li:corpuser:foo@xyz.com",
"count": 4 "count": 4,
"userEmail": "foo@xyz.com"
} }
], ],
"fieldCounts": [] "fieldCounts": []
@ -162,7 +163,7 @@
}, },
"systemMetadata": { "systemMetadata": {
"lastObserved": 1643871600000, "lastObserved": 1643871600000,
"runId": "bigquery-2022_02_03-07_00_00-6mhnuz", "runId": "bigquery-2022_02_03-07_00_00-pj1cgp",
"lastRunId": "no-run-id-provided" "lastRunId": "no-run-id-provided"
} }
}, },
@ -214,7 +215,7 @@
"partition": "FULL_TABLE_SNAPSHOT", "partition": "FULL_TABLE_SNAPSHOT",
"type": "FULL_TABLE" "type": "FULL_TABLE"
}, },
"actor": "urn:li:corpuser:foo", "actor": "urn:li:corpuser:foo@xyz.com",
"operationType": "CREATE", "operationType": "CREATE",
"sourceType": "DATA_PLATFORM", "sourceType": "DATA_PLATFORM",
"lastUpdatedTimestamp": 1643871600000, "lastUpdatedTimestamp": 1643871600000,
@ -225,7 +226,7 @@
}, },
"systemMetadata": { "systemMetadata": {
"lastObserved": 1643871600000, "lastObserved": 1643871600000,
"runId": "bigquery-2022_02_03-07_00_00-6mhnuz", "runId": "bigquery-2022_02_03-07_00_00-pj1cgp",
"lastRunId": "no-run-id-provided" "lastRunId": "no-run-id-provided"
} }
}, },
@ -314,7 +315,7 @@
"uniqueUserCount": 1, "uniqueUserCount": 1,
"userCounts": [ "userCounts": [
{ {
"user": "urn:li:corpuser:foo", "user": "urn:li:corpuser:foo@xyz.com",
"count": 2 "count": 2
} }
] ]
@ -322,7 +323,7 @@
}, },
"systemMetadata": { "systemMetadata": {
"lastObserved": 1643871600000, "lastObserved": 1643871600000,
"runId": "bigquery-2022_02_03-07_00_00-6mhnuz", "runId": "bigquery-2022_02_03-07_00_00-pj1cgp",
"lastRunId": "no-run-id-provided" "lastRunId": "no-run-id-provided"
} }
}, },

View File

@ -1061,7 +1061,7 @@ def test_operational_stats(
OperationClass( OperationClass(
timestampMillis=int(FROZEN_TIME.timestamp() * 1000), timestampMillis=int(FROZEN_TIME.timestamp() * 1000),
lastUpdatedTimestamp=int(query.timestamp.timestamp() * 1000), lastUpdatedTimestamp=int(query.timestamp.timestamp() * 1000),
actor=f"urn:li:corpuser:{query.actor.split('@')[0]}", actor=f"urn:li:corpuser:{query.actor}",
operationType=( operationType=(
query.type query.type
if query.type in OPERATION_STATEMENT_TYPES.values() if query.type in OPERATION_STATEMENT_TYPES.values()