mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-02 03:39:03 +00:00
chore(metabase): use non deprecated fields in ChartInfo and DashboardInfo aspects (#15102)
This commit is contained in:
parent
ee20dbbcb3
commit
f844ea7b2d
@ -52,6 +52,7 @@ from datahub.metadata.schema_classes import (
|
||||
ChartQueryTypeClass,
|
||||
ChartTypeClass,
|
||||
DashboardInfoClass,
|
||||
EdgeClass,
|
||||
OwnerClass,
|
||||
OwnershipClass,
|
||||
OwnershipTypeClass,
|
||||
@ -338,19 +339,25 @@ class MetabaseSource(StatefulIngestionSourceBase):
|
||||
lastModified=AuditStamp(time=modified_ts, actor=modified_actor),
|
||||
)
|
||||
|
||||
chart_urns = []
|
||||
# Convert chart URNs to chart edges (instead of deprecated charts field)
|
||||
chart_edges = []
|
||||
cards_data = dashboard_details.get("dashcards", {})
|
||||
for card_info in cards_data:
|
||||
card_id = card_info.get("card").get("id", "")
|
||||
if not card_id:
|
||||
continue # most likely a virtual card without an id (text or heading), not relevant.
|
||||
chart_urn = builder.make_chart_urn(self.platform, str(card_id))
|
||||
chart_urns.append(chart_urn)
|
||||
chart_edges.append(
|
||||
EdgeClass(
|
||||
destinationUrn=chart_urn,
|
||||
lastModified=last_modified.lastModified,
|
||||
)
|
||||
)
|
||||
|
||||
dashboard_info_class = DashboardInfoClass(
|
||||
description=description,
|
||||
title=title,
|
||||
charts=chart_urns,
|
||||
chartEdges=chart_edges,
|
||||
lastModified=last_modified,
|
||||
dashboardUrl=f"{self.config.display_uri}/dashboard/{dashboard_id}",
|
||||
customProperties={},
|
||||
@ -488,13 +495,25 @@ class MetabaseSource(StatefulIngestionSourceBase):
|
||||
datasource_urn = self.get_datasource_urn(card_details)
|
||||
custom_properties = self.construct_card_custom_properties(card_details)
|
||||
|
||||
input_edges = (
|
||||
[
|
||||
EdgeClass(
|
||||
destinationUrn=urn,
|
||||
lastModified=last_modified.lastModified,
|
||||
)
|
||||
for urn in datasource_urn
|
||||
]
|
||||
if datasource_urn
|
||||
else None
|
||||
)
|
||||
|
||||
chart_info = ChartInfoClass(
|
||||
type=chart_type,
|
||||
description=description,
|
||||
title=title,
|
||||
lastModified=last_modified,
|
||||
chartUrl=f"{self.config.display_uri}/card/{card_id}",
|
||||
inputs=datasource_urn,
|
||||
inputEdges=input_edges,
|
||||
customProperties=custom_properties,
|
||||
)
|
||||
chart_snapshot.aspects.append(chart_info)
|
||||
|
||||
@ -24,12 +24,20 @@
|
||||
}
|
||||
},
|
||||
"chartUrl": "http://localhost:3000/card/1",
|
||||
"inputs": [
|
||||
"inputEdges": [
|
||||
{
|
||||
"string": "urn:li:dataset:(urn:li:dataPlatform:bigquery,acryl-data.public.customer,PROD)"
|
||||
"destinationUrn": "urn:li:dataset:(urn:li:dataPlatform:bigquery,acryl-data.public.customer,PROD)",
|
||||
"lastModified": {
|
||||
"time": 1639417592792,
|
||||
"actor": "urn:li:corpuser:admin@metabase.com"
|
||||
}
|
||||
},
|
||||
{
|
||||
"string": "urn:li:dataset:(urn:li:dataPlatform:bigquery,acryl-data.public.payment,PROD)"
|
||||
"destinationUrn": "urn:li:dataset:(urn:li:dataPlatform:bigquery,acryl-data.public.payment,PROD)",
|
||||
"lastModified": {
|
||||
"time": 1639417592792,
|
||||
"actor": "urn:li:corpuser:admin@metabase.com"
|
||||
}
|
||||
}
|
||||
],
|
||||
"type": "TABLE"
|
||||
@ -91,9 +99,13 @@
|
||||
}
|
||||
},
|
||||
"chartUrl": "http://localhost:3000/card/2",
|
||||
"inputs": [
|
||||
"inputEdges": [
|
||||
{
|
||||
"string": "urn:li:dataset:(urn:li:dataPlatform:postgres,dvdrental.public.film,PROD)"
|
||||
"destinationUrn": "urn:li:dataset:(urn:li:dataPlatform:postgres,dvdrental.public.film,PROD)",
|
||||
"lastModified": {
|
||||
"time": 1636614000000,
|
||||
"actor": "urn:li:corpuser:admin@metabase.com"
|
||||
}
|
||||
}
|
||||
],
|
||||
"type": "BAR"
|
||||
@ -149,12 +161,20 @@
|
||||
}
|
||||
},
|
||||
"chartUrl": "http://localhost:3000/card/3",
|
||||
"inputs": [
|
||||
"inputEdges": [
|
||||
{
|
||||
"string": "urn:li:dataset:(urn:li:dataPlatform:bigquery,acryl-data.public.customer,PROD)"
|
||||
"destinationUrn": "urn:li:dataset:(urn:li:dataPlatform:bigquery,acryl-data.public.customer,PROD)",
|
||||
"lastModified": {
|
||||
"time": 1685628119636,
|
||||
"actor": "urn:li:corpuser:john.doe@example.com"
|
||||
}
|
||||
},
|
||||
{
|
||||
"string": "urn:li:dataset:(urn:li:dataPlatform:bigquery,acryl-data.public.payment,PROD)"
|
||||
"destinationUrn": "urn:li:dataset:(urn:li:dataPlatform:bigquery,acryl-data.public.payment,PROD)",
|
||||
"lastModified": {
|
||||
"time": 1685628119636,
|
||||
"actor": "urn:li:corpuser:john.doe@example.com"
|
||||
}
|
||||
}
|
||||
],
|
||||
"type": "TABLE"
|
||||
@ -195,12 +215,32 @@
|
||||
"customProperties": {},
|
||||
"title": "Dashboard 1",
|
||||
"description": "",
|
||||
"charts": [
|
||||
"urn:li:chart:(metabase,1)",
|
||||
"urn:li:chart:(metabase,2)",
|
||||
"urn:li:chart:(metabase,3)"
|
||||
"charts": [],
|
||||
"chartEdges": [
|
||||
{
|
||||
"destinationUrn": "urn:li:chart:(metabase,1)",
|
||||
"lastModified": {
|
||||
"time": 1705398694904,
|
||||
"actor": "urn:li:corpuser:admin@metabase.com"
|
||||
}
|
||||
},
|
||||
{
|
||||
"destinationUrn": "urn:li:chart:(metabase,2)",
|
||||
"lastModified": {
|
||||
"time": 1705398694904,
|
||||
"actor": "urn:li:corpuser:admin@metabase.com"
|
||||
}
|
||||
},
|
||||
{
|
||||
"destinationUrn": "urn:li:chart:(metabase,3)",
|
||||
"lastModified": {
|
||||
"time": 1705398694904,
|
||||
"actor": "urn:li:corpuser:admin@metabase.com"
|
||||
}
|
||||
}
|
||||
],
|
||||
"datasets": [],
|
||||
"dashboards": [],
|
||||
"lastModified": {
|
||||
"created": {
|
||||
"time": 1705398694904,
|
||||
@ -249,12 +289,32 @@
|
||||
"customProperties": {},
|
||||
"title": "Dashboard 2",
|
||||
"description": "",
|
||||
"charts": [
|
||||
"urn:li:chart:(metabase,1)",
|
||||
"urn:li:chart:(metabase,2)",
|
||||
"urn:li:chart:(metabase,3)"
|
||||
"charts": [],
|
||||
"chartEdges": [
|
||||
{
|
||||
"destinationUrn": "urn:li:chart:(metabase,1)",
|
||||
"lastModified": {
|
||||
"time": 1705398694904,
|
||||
"actor": "urn:li:corpuser:admin@metabase.com"
|
||||
}
|
||||
},
|
||||
{
|
||||
"destinationUrn": "urn:li:chart:(metabase,2)",
|
||||
"lastModified": {
|
||||
"time": 1705398694904,
|
||||
"actor": "urn:li:corpuser:admin@metabase.com"
|
||||
}
|
||||
},
|
||||
{
|
||||
"destinationUrn": "urn:li:chart:(metabase,3)",
|
||||
"lastModified": {
|
||||
"time": 1705398694904,
|
||||
"actor": "urn:li:corpuser:admin@metabase.com"
|
||||
}
|
||||
}
|
||||
],
|
||||
"datasets": [],
|
||||
"dashboards": [],
|
||||
"lastModified": {
|
||||
"created": {
|
||||
"time": 1705398694904,
|
||||
@ -303,12 +363,32 @@
|
||||
"customProperties": {},
|
||||
"title": "Dashboard 1",
|
||||
"description": "",
|
||||
"charts": [
|
||||
"urn:li:chart:(metabase,1)",
|
||||
"urn:li:chart:(metabase,2)",
|
||||
"urn:li:chart:(metabase,3)"
|
||||
"charts": [],
|
||||
"chartEdges": [
|
||||
{
|
||||
"destinationUrn": "urn:li:chart:(metabase,1)",
|
||||
"lastModified": {
|
||||
"time": 1705398694904,
|
||||
"actor": "urn:li:corpuser:admin@metabase.com"
|
||||
}
|
||||
},
|
||||
{
|
||||
"destinationUrn": "urn:li:chart:(metabase,2)",
|
||||
"lastModified": {
|
||||
"time": 1705398694904,
|
||||
"actor": "urn:li:corpuser:admin@metabase.com"
|
||||
}
|
||||
},
|
||||
{
|
||||
"destinationUrn": "urn:li:chart:(metabase,3)",
|
||||
"lastModified": {
|
||||
"time": 1705398694904,
|
||||
"actor": "urn:li:corpuser:admin@metabase.com"
|
||||
}
|
||||
}
|
||||
],
|
||||
"datasets": [],
|
||||
"dashboards": [],
|
||||
"lastModified": {
|
||||
"created": {
|
||||
"time": 1705398694904,
|
||||
@ -357,12 +437,32 @@
|
||||
"customProperties": {},
|
||||
"title": "Dashboard 2",
|
||||
"description": "",
|
||||
"charts": [
|
||||
"urn:li:chart:(metabase,1)",
|
||||
"urn:li:chart:(metabase,2)",
|
||||
"urn:li:chart:(metabase,3)"
|
||||
"charts": [],
|
||||
"chartEdges": [
|
||||
{
|
||||
"destinationUrn": "urn:li:chart:(metabase,1)",
|
||||
"lastModified": {
|
||||
"time": 1705398694904,
|
||||
"actor": "urn:li:corpuser:admin@metabase.com"
|
||||
}
|
||||
},
|
||||
{
|
||||
"destinationUrn": "urn:li:chart:(metabase,2)",
|
||||
"lastModified": {
|
||||
"time": 1705398694904,
|
||||
"actor": "urn:li:corpuser:admin@metabase.com"
|
||||
}
|
||||
},
|
||||
{
|
||||
"destinationUrn": "urn:li:chart:(metabase,3)",
|
||||
"lastModified": {
|
||||
"time": 1705398694904,
|
||||
"actor": "urn:li:corpuser:admin@metabase.com"
|
||||
}
|
||||
}
|
||||
],
|
||||
"datasets": [],
|
||||
"dashboards": [],
|
||||
"lastModified": {
|
||||
"created": {
|
||||
"time": 1705398694904,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user