Skip to content

Commit 8c1fa04

Browse files
asikowitzpedro93
andauthored
fix(ingest/snowflake): Allow SnowflakeObjectAccessEntry.objectId to be None (#7601)
Co-authored-by: Pedro Silva <[email protected]>
1 parent bcda510 commit 8c1fa04

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

metadata-ingestion/src/datahub/ingestion/source/snowflake/snowflake_usage_v2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ class SnowflakeColumnReference(PermissiveModel):
6666
class SnowflakeObjectAccessEntry(PermissiveModel):
6767
columns: Optional[List[SnowflakeColumnReference]]
6868
objectDomain: str
69-
objectId: int
7069
objectName: str
70+
# Seems like it should never be null, but in practice have seen null objectIds
71+
objectId: Optional[int]
7172
stageKind: Optional[str]
7273

7374

metadata-ingestion/tests/unit/test_snowflake_source.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
SnowflakeCloudProvider,
1212
)
1313
from datahub.ingestion.source.snowflake.snowflake_config import SnowflakeV2Config
14+
from datahub.ingestion.source.snowflake.snowflake_usage_v2 import (
15+
SnowflakeObjectAccessEntry,
16+
)
1417
from datahub.ingestion.source.snowflake.snowflake_v2 import SnowflakeV2Source
1518

1619

@@ -546,3 +549,16 @@ def test_unknown_cloud_region_from_snowflake_region_id():
546549
"somecloud_someregion"
547550
)
548551
assert "Unknown snowflake region" in str(e)
552+
553+
554+
def test_snowflake_object_access_entry_missing_object_id():
555+
SnowflakeObjectAccessEntry(
556+
**{
557+
"columns": [
558+
{"columnName": "A"},
559+
{"columnName": "B"},
560+
],
561+
"objectDomain": "View",
562+
"objectName": "SOME.OBJECT.NAME",
563+
}
564+
)

0 commit comments

Comments
 (0)