Skip to content

Commit

Permalink
destination dataset urn corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamjagtap639 committed Nov 1, 2023
1 parent f1fdb04 commit c92d4fc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

class FivetranLogAPI:
def __init__(self, fivetran_log_config: FivetranLogConfig) -> None:
self.fivetran_log_database = None
self.fivetran_log_config = fivetran_log_config
self.engine = self._get_log_destination_engine()

Expand All @@ -37,6 +38,7 @@ def _get_log_destination_engine(self) -> Any:
snowflake_destination_config.log_schema,
)
)
self.fivetran_log_database = snowflake_destination_config.database
return engine

def _query(self, query: str) -> List[Dict]:
Expand Down Expand Up @@ -66,7 +68,7 @@ def _get_table_lineage(self, connector_id: str) -> List[TableLineage]:
table_lineage_list.append(
TableLineage(
source_table=f"{table_lineage[Constant.SOURCE_SCHEMA_NAME]}.{table_lineage[Constant.SOURCE_TABLE_NAME]}",
destination_table=f"{table_lineage[Constant.DESTINATION_SCHEMA_NAME]}.{table_lineage[Constant.DESTINATION_TABLE_NAME]}",
destination_table=f"{self.fivetran_log_database.lower()}.{table_lineage[Constant.DESTINATION_SCHEMA_NAME]}.{table_lineage[Constant.DESTINATION_TABLE_NAME]}",
column_lineage=column_lineage_list,
)
)
Expand Down
28 changes: 14 additions & 14 deletions metadata-ingestion/tests/integration/fivetran/fivetran_golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@
"urn:li:dataset:(urn:li:dataPlatform:postgres,public.company,DEV)"
],
"outputDatasets": [
"urn:li:dataset:(urn:li:dataPlatform:snowflake,postgres_public.employee,PROD)",
"urn:li:dataset:(urn:li:dataPlatform:snowflake,postgres_public.company,PROD)"
"urn:li:dataset:(urn:li:dataPlatform:snowflake,test_database.postgres_public.employee,PROD)",
"urn:li:dataset:(urn:li:dataPlatform:snowflake,test_database.postgres_public.company,PROD)"
],
"inputDatajobs": [],
"fineGrainedLineages": [
Expand All @@ -100,7 +100,7 @@
],
"downstreamType": "FIELD",
"downstreams": [
"urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:snowflake,postgres_public.employee,PROD),id)"
"urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:snowflake,test_database.postgres_public.employee,PROD),id)"
],
"confidenceScore": 1.0
},
Expand All @@ -111,7 +111,7 @@
],
"downstreamType": "FIELD",
"downstreams": [
"urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:snowflake,postgres_public.employee,PROD),name)"
"urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:snowflake,test_database.postgres_public.employee,PROD),name)"
],
"confidenceScore": 1.0
},
Expand All @@ -122,7 +122,7 @@
],
"downstreamType": "FIELD",
"downstreams": [
"urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:snowflake,postgres_public.company,PROD),id)"
"urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:snowflake,test_database.postgres_public.company,PROD),id)"
],
"confidenceScore": 1.0
},
Expand All @@ -133,7 +133,7 @@
],
"downstreamType": "FIELD",
"downstreams": [
"urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:snowflake,postgres_public.company,PROD),name)"
"urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:snowflake,test_database.postgres_public.company,PROD),name)"
],
"confidenceScore": 1.0
}
Expand Down Expand Up @@ -180,7 +180,7 @@
},
{
"entityType": "dataset",
"entityUrn": "urn:li:dataset:(urn:li:dataPlatform:snowflake,postgres_public.employee,PROD)",
"entityUrn": "urn:li:dataset:(urn:li:dataPlatform:snowflake,test_database.postgres_public.employee,PROD)",
"changeType": "UPSERT",
"aspectName": "status",
"aspect": {
Expand All @@ -196,7 +196,7 @@
},
{
"entityType": "dataset",
"entityUrn": "urn:li:dataset:(urn:li:dataPlatform:snowflake,postgres_public.company,PROD)",
"entityUrn": "urn:li:dataset:(urn:li:dataPlatform:snowflake,test_database.postgres_public.company,PROD)",
"changeType": "UPSERT",
"aspectName": "status",
"aspect": {
Expand Down Expand Up @@ -320,8 +320,8 @@
"aspect": {
"json": {
"outputs": [
"urn:li:dataset:(urn:li:dataPlatform:snowflake,postgres_public.employee,PROD)",
"urn:li:dataset:(urn:li:dataPlatform:snowflake,postgres_public.company,PROD)"
"urn:li:dataset:(urn:li:dataPlatform:snowflake,test_database.postgres_public.employee,PROD)",
"urn:li:dataset:(urn:li:dataPlatform:snowflake,test_database.postgres_public.company,PROD)"
]
}
},
Expand Down Expand Up @@ -443,8 +443,8 @@
"aspect": {
"json": {
"outputs": [
"urn:li:dataset:(urn:li:dataPlatform:snowflake,postgres_public.employee,PROD)",
"urn:li:dataset:(urn:li:dataPlatform:snowflake,postgres_public.company,PROD)"
"urn:li:dataset:(urn:li:dataPlatform:snowflake,test_database.postgres_public.employee,PROD)",
"urn:li:dataset:(urn:li:dataPlatform:snowflake,test_database.postgres_public.company,PROD)"
]
}
},
Expand Down Expand Up @@ -566,8 +566,8 @@
"aspect": {
"json": {
"outputs": [
"urn:li:dataset:(urn:li:dataPlatform:snowflake,postgres_public.employee,PROD)",
"urn:li:dataset:(urn:li:dataPlatform:snowflake,postgres_public.company,PROD)"
"urn:li:dataset:(urn:li:dataPlatform:snowflake,test_database.postgres_public.employee,PROD)",
"urn:li:dataset:(urn:li:dataPlatform:snowflake,test_database.postgres_public.company,PROD)"
]
}
},
Expand Down

0 comments on commit c92d4fc

Please sign in to comment.