Skip to content

Commit

Permalink
Merge branch 'main' into bump-release-2.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Aryamanz29 authored Apr 3, 2024
2 parents 51694f3 + c159611 commit 6d7c3c8
Show file tree
Hide file tree
Showing 11 changed files with 746 additions and 258 deletions.
2 changes: 1 addition & 1 deletion pyatlan/model/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class Config:
"Whether to prevent this Atlan tag from propagating through "
"hierarchy (True) or allow it to propagate through hierarchy (False)"
),
alias="restrictPropagationThroughHierachy",
alias="restrictPropagationThroughHierarchy",
)
validity_periods: Optional[List[str]] = Field(default=None, alias="validityPeriods")
_source_tag_attachements: List[SourceTagAttachment] = PrivateAttr(
Expand Down
9 changes: 5 additions & 4 deletions pyatlan/model/events.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2023 Atlan Pte. Ltd.
from typing import Any, Dict, Literal, Optional, Union
from typing import Any, Dict, List, Literal, Optional, Union

from pydantic.v1 import Field

Expand Down Expand Up @@ -84,7 +84,7 @@ class AtlanTagAddPayload(
operation_type: Literal["CLASSIFICATION_ADD"] = Field(
description="Type of the operation the event contains a payload for."
)
mutated_details: Optional[AtlanTag] = Field(
mutated_details: Optional[List[AtlanTag]] = Field(
description="Atlan tags that were added to the asset by this event."
)

Expand All @@ -95,7 +95,7 @@ class AtlanTagDeletePayload(
operation_type: Literal["CLASSIFICATION_DELETE"] = Field(
description="Type of the operation the event contains a payload for."
)
mutated_details: Optional[AtlanTag] = Field(
mutated_details: Optional[List[AtlanTag]] = Field(
description="Atlan tags that were removed from the asset by this event."
)

Expand All @@ -118,9 +118,10 @@ class AtlanEvent(AtlanObject):
Union[
AssetCreatePayload,
AssetUpdatePayload,
CustomMetadataUpdatePayload,
AssetDeletePayload,
AtlanTagAddPayload,
AtlanTagDeletePayload,
CustomMetadataUpdatePayload,
]
] = Field(
description="Detailed contents (payload) of the event.",
Expand Down
40 changes: 40 additions & 0 deletions tests/unit/data/event_responses/actual.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"version": "2.0",
"routeKey": "$default",
"rawPath": "/",
"rawQueryString": "",
"headers": {
"content-length": "85",
"x-atlan-signing-secret": "test-secret",
"x-amzn-tls-cipher-suite": "ECDHE-RSA-AES128-GCM-SHA256",
"x-amzn-tls-version": "TLSv1.2",
"x-amzn-trace-id": "Root=1-64931f85-02856e0b115997577ed16d97",
"x-forwarded-proto": "https",
"host": "uo8rokyifhnhubgagp106xhrpvgmuqhx.lambda-url.us-east-1.on.aws",
"x-forwarded-port": "443",
"content-type": "text/plain; charset=utf-8",
"x-forwarded-for": "34.194.9.164",
"accept-encoding": "gzip",
"user-agent": "go-resty/1.12.0 (https://github.com/go-resty/resty)"
},
"requestContext": {
"accountId": "anonymous",
"apiId": "uo8rokyifhnhubgagp106xhrpvgmuqhx",
"domainName": "uo8rokyifhnhubgagp106xhrpvgmuqhx.lambda-url.us-east-1.on.aws",
"domainPrefix": "uo8rokyifhnhubgagp106xhrpvgmuqhx",
"http": {
"method": "POST",
"path": "/",
"protocol": "HTTP/1.1",
"sourceIp": "34.194.9.164",
"userAgent": "go-resty/1.12.0 (https://github.com/go-resty/resty)"
},
"requestId": "27539f31-d444-419e-b1ad-4382657b7e04",
"routeKey": "$default",
"stage": "$default",
"time": "21/Jun/2023:16:04:21 +0000",
"timeEpoch": 1687363461544
},
"body": "{\"source\":{},\"version\":{\"version\":\"1.0.0\",\"versionParts\":[1]},\"msgCompressionKind\":\"NONE\",\"msgSplitIdx\":1,\"msgSplitCount\":1,\"msgSourceIP\":\"10.121.193.228\",\"msgCreatedBy\":\"\",\"msgCreationTime\":1666792334952,\"spooled\":false,\"message\":{\"type\":\"ENTITY_NOTIFICATION_V2\",\"entity\":{\"typeName\":\"AtlasGlossaryTerm\",\"attributes\":{\"qualifiedName\":\"rrSsMGHn1q1W2dWHqSHWe@Q07rYkHOACJkmUZJgmKFP\",\"name\":\"Example\"},\"guid\":\"bacab52b-6c4b-4dbe-b5da-97ec2e509c7e\",\"status\":\"ACTIVE\",\"displayText\":\"Example\"},\"operationType\":\"ENTITY_CREATE\",\"eventTime\":1666792332986}}",
"isBase64Encoded": false
}
84 changes: 84 additions & 0 deletions tests/unit/data/event_responses/business_attribute_update.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"source": {},
"version": {
"version": "1.0.0",
"versionParts": [
1
]
},
"msgCompressionKind": "NONE",
"msgSplitIdx": 1,
"msgSplitCount": 1,
"msgSourceIP": "10.121.193.228",
"msgCreatedBy": "",
"msgCreationTime": 1667822461771,
"spooled": false,
"message": {
"type": "ENTITY_NOTIFICATION_V2",
"entity": {
"typeName": "Table",
"attributes": {
"popularityScore": 1.17549435e-38,
"lastSyncWorkflowName": "mabl-qa-006-crawler",
"lastSyncRunAt": 1665132063880,
"databaseName": "atlan_trial",
"connectionQualifiedName": "default/postgres/1665131987",
"assetDbtJobLastRunHasSourcesGenerated": false,
"assetDbtJobLastRunHasDocsGenerated": false,
"queryCount": 0,
"isTemporary": false,
"lastSyncRun": "atlan-postgres-1665131987-k9cds",
"isPartitioned": false,
"schemaName": "demo",
"adminUsers": [],
"partitionCount": 0,
"queryUserCount": 0,
"assetDbtJobLastRunUpdatedAt": 0,
"ownerGroups": [],
"sourceUpdatedAt": 0,
"assetDbtJobLastRunArtifactsSaved": false,
"isEditable": true,
"announcementUpdatedAt": 0,
"assetDbtJobLastRunStartedAt": 0,
"isDiscoverable": true,
"rowCount": 134,
"isQueryPreview": true,
"schemaQualifiedName": "default/postgres/1665131987/atlan_trial/demo",
"sourceCreatedAt": 0,
"assetDbtJobLastRunDequedAt": 0,
"viewerUsers": [],
"assetDbtTags": [],
"adminRoles": [],
"adminGroups": [],
"assetDbtJobLastRunCreatedAt": 0,
"qualifiedName": "default/postgres/1665131987/atlan_trial/demo/INSTACART_AISLES",
"databaseQualifiedName": "default/postgres/1665131987/atlan_trial",
"assetDbtJobNextRun": 0,
"assetDbtJobLastRunNotificationsSent": false,
"columnCount": 2,
"sizeBytes": 0,
"name": "INSTACART_AISLES",
"certificateUpdatedAt": 0,
"connectorName": "postgres",
"viewerGroups": [],
"assetDbtJobLastRun": 0,
"ownerUsers": []
},
"guid": "31ee0651-b031-48c8-8927-ef9b1e949ad4",
"status": "ACTIVE",
"displayText": "INSTACART_AISLES",
"isIncomplete": false,
"createdBy": "autoqa",
"updatedBy": "autoqa",
"createTime": 1665132167750,
"updateTime": 1665132175423
},
"operationType": "BUSINESS_ATTRIBUTE_UPDATE",
"eventTime": 1667822461710,
"mutatedDetails": {
"UuPz0CjWHFuuKTCiTRwapk": {
"jpf1oz5ux6MjmaOGPn9jMD": "ssjmdvddf\n"
}
}
}
}
113 changes: 113 additions & 0 deletions tests/unit/data/event_responses/classification_add.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"source": {},
"version": {
"version": "1.0.0",
"versionParts": [
1
]
},
"msgCompressionKind": "NONE",
"msgSplitIdx": 1,
"msgSplitCount": 1,
"msgSourceIP": "10.121.193.228",
"msgCreatedBy": "",
"msgCreationTime": 1666964451608,
"spooled": false,
"message": {
"type": "ENTITY_NOTIFICATION_V2",
"entity": {
"typeName": "Column",
"attributes": {
"popularityScore": 1.17549435e-38,
"lastSyncRunAt": 1666792022425,
"databaseName": "FIVETRAN",
"precision": 18,
"lastSyncRun": "atlan-snowflake-1666769582-55jct",
"schemaName": "POSTGRES_RDS_DEMO_DEV",
"tableName": "INSTACART_UNIQUE_USERS",
"adminUsers": [],
"queryUserCount": 0,
"sourceUpdatedAt": 0,
"assetDbtJobLastRunArtifactsSaved": false,
"isEditable": true,
"isPartition": false,
"announcementUpdatedAt": 0,
"order": 1,
"sourceCreatedAt": 0,
"assetDbtJobLastRunDequedAt": 0,
"assetDbtTags": [],
"isIndexed": false,
"qualifiedName": "default/snowflake/1666769582/FIVETRAN/POSTGRES_RDS_DEMO_DEV/INSTACART_UNIQUE_USERS/TOTAL_USER",
"dataType": "NUMBER",
"assetDbtJobLastRunNotificationsSent": false,
"isClustered": false,
"isNullable": false,
"name": "TOTAL_USER",
"certificateUpdatedAt": 0,
"connectorName": "snowflake",
"numericScale": 0,
"maxLength": 0,
"ownerUsers": [],
"isSort": false,
"lastSyncWorkflowName": "activate-poc-crawler",
"connectionQualifiedName": "default/snowflake/1666769582",
"assetDbtJobLastRunHasSourcesGenerated": false,
"isForeign": false,
"assetDbtJobLastRunHasDocsGenerated": false,
"queryCount": 0,
"pinnedAt": 0,
"isDist": false,
"assetDbtJobLastRunUpdatedAt": 0,
"ownerGroups": [],
"isPrimary": false,
"assetDbtJobLastRunStartedAt": 0,
"isDiscoverable": true,
"schemaQualifiedName": "default/snowflake/1666769582/FIVETRAN/POSTGRES_RDS_DEMO_DEV",
"viewerUsers": [],
"adminRoles": [],
"adminGroups": [],
"isPinned": false,
"assetDbtJobLastRunCreatedAt": 0,
"databaseQualifiedName": "default/snowflake/1666769582/FIVETRAN",
"assetDbtJobNextRun": 0,
"tableQualifiedName": "default/snowflake/1666769582/FIVETRAN/POSTGRES_RDS_DEMO_DEV/INSTACART_UNIQUE_USERS",
"partitionOrder": 0,
"viewerGroups": [],
"assetDbtJobLastRun": 0
},
"guid": "9065bba5-22b8-4331-bff8-1bdf017c5cfb",
"status": "ACTIVE",
"displayText": "TOTAL_USER",
"classificationNames": [
"jUQpLPdg9hWoheH2eL9Ha2"
],
"classifications": [
{
"typeName": "jUQpLPdg9hWoheH2eL9Ha2",
"entityGuid": "9065bba5-22b8-4331-bff8-1bdf017c5cfb",
"entityStatus": "ACTIVE",
"propagate": true,
"removePropagationsOnEntityDelete": true,
"restrictPropagationThroughLineage": false
}
],
"isIncomplete": false,
"createdBy": "kartik.thakur",
"updatedBy": "kartik.thakur",
"createTime": 1666792644294,
"updateTime": 1666964451417
},
"operationType": "CLASSIFICATION_ADD",
"eventTime": 1666964451417,
"mutatedDetails": [
{
"typeName": "jUQpLPdg9hWoheH2eL9Ha2",
"entityGuid": "9065bba5-22b8-4331-bff8-1bdf017c5cfb",
"entityStatus": "ACTIVE",
"propagate": true,
"removePropagationsOnEntityDelete": true,
"restrictPropagationThroughLineage": false
}
]
}
}
100 changes: 100 additions & 0 deletions tests/unit/data/event_responses/classification_delete.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"source": {},
"version": {
"version": "1.0.0",
"versionParts": [
1
]
},
"msgCompressionKind": "NONE",
"msgSplitIdx": 1,
"msgSplitCount": 1,
"msgSourceIP": "10.121.193.228",
"msgCreatedBy": "",
"msgCreationTime": 1666964493302,
"spooled": false,
"message": {
"type": "ENTITY_NOTIFICATION_V2",
"entity": {
"typeName": "Column",
"attributes": {
"popularityScore": 1.17549435e-38,
"lastSyncRunAt": 1666792022425,
"databaseName": "FIVETRAN",
"precision": 18,
"lastSyncRun": "atlan-snowflake-1666769582-55jct",
"schemaName": "POSTGRES_RDS_DEMO_DEV",
"tableName": "INSTACART_UNIQUE_USERS",
"adminUsers": [],
"queryUserCount": 0,
"sourceUpdatedAt": 0,
"assetDbtJobLastRunArtifactsSaved": false,
"isEditable": true,
"isPartition": false,
"announcementUpdatedAt": 0,
"order": 1,
"sourceCreatedAt": 0,
"assetDbtJobLastRunDequedAt": 0,
"assetDbtTags": [],
"isIndexed": false,
"qualifiedName": "default/snowflake/1666769582/FIVETRAN/POSTGRES_RDS_DEMO_DEV/INSTACART_UNIQUE_USERS/TOTAL_USER",
"dataType": "NUMBER",
"assetDbtJobLastRunNotificationsSent": false,
"isClustered": false,
"isNullable": false,
"name": "TOTAL_USER",
"certificateUpdatedAt": 0,
"connectorName": "snowflake",
"numericScale": 0,
"maxLength": 0,
"ownerUsers": [],
"isSort": false,
"lastSyncWorkflowName": "activate-poc-crawler",
"connectionQualifiedName": "default/snowflake/1666769582",
"assetDbtJobLastRunHasSourcesGenerated": false,
"isForeign": false,
"assetDbtJobLastRunHasDocsGenerated": false,
"queryCount": 0,
"pinnedAt": 0,
"isDist": false,
"assetDbtJobLastRunUpdatedAt": 0,
"ownerGroups": [],
"isPrimary": false,
"assetDbtJobLastRunStartedAt": 0,
"isDiscoverable": true,
"schemaQualifiedName": "default/snowflake/1666769582/FIVETRAN/POSTGRES_RDS_DEMO_DEV",
"viewerUsers": [],
"adminRoles": [],
"adminGroups": [],
"isPinned": false,
"assetDbtJobLastRunCreatedAt": 0,
"databaseQualifiedName": "default/snowflake/1666769582/FIVETRAN",
"assetDbtJobNextRun": 0,
"tableQualifiedName": "default/snowflake/1666769582/FIVETRAN/POSTGRES_RDS_DEMO_DEV/INSTACART_UNIQUE_USERS",
"partitionOrder": 0,
"viewerGroups": [],
"assetDbtJobLastRun": 0
},
"guid": "9065bba5-22b8-4331-bff8-1bdf017c5cfb",
"status": "ACTIVE",
"displayText": "TOTAL_USER",
"isIncomplete": false,
"createdBy": "kartik.thakur",
"updatedBy": "kartik.thakur",
"createTime": 1666792644294,
"updateTime": 1666964493133
},
"operationType": "CLASSIFICATION_DELETE",
"eventTime": 1666964493133,
"mutatedDetails": [
{
"typeName": "jUQpLPdg9hWoheH2eL9Ha2",
"entityGuid": "9065bba5-22b8-4331-bff8-1bdf017c5cfb",
"entityStatus": "ACTIVE",
"propagate": true,
"removePropagationsOnEntityDelete": true,
"restrictPropagationThroughLineage": false
}
]
}
}
Loading

0 comments on commit 6d7c3c8

Please sign in to comment.