mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-01 05:03:10 +00:00
MINOR: Add location path to table entity (#18307)
This commit is contained in:
parent
0741788744
commit
5801e6c380
@ -478,6 +478,12 @@ class CommonDbSourceService(
|
|||||||
"""Not Implemented"""
|
"""Not Implemented"""
|
||||||
yield from []
|
yield from []
|
||||||
|
|
||||||
|
def get_location_path(self, table_name: str, schema_name: str) -> Optional[str]:
|
||||||
|
"""
|
||||||
|
Method to fetch the location path of the table
|
||||||
|
by default there will be no location path
|
||||||
|
"""
|
||||||
|
|
||||||
@calculate_execution_time_generator()
|
@calculate_execution_time_generator()
|
||||||
def yield_table(
|
def yield_table(
|
||||||
self, table_name_and_type: Tuple[str, TableType]
|
self, table_name_and_type: Tuple[str, TableType]
|
||||||
@ -553,6 +559,9 @@ class CommonDbSourceService(
|
|||||||
table_type=table_type,
|
table_type=table_type,
|
||||||
),
|
),
|
||||||
owners=self.get_owner_ref(table_name=table_name),
|
owners=self.get_owner_ref(table_name=table_name),
|
||||||
|
locationPath=self.get_location_path(
|
||||||
|
table_name=table_name, schema_name=schema_name
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
is_partitioned, partition_details = self.get_table_partition_details(
|
is_partitioned, partition_details = self.get_table_partition_details(
|
||||||
|
@ -705,6 +705,14 @@ class DatabricksSource(ExternalTableLineageMixin, CommonDbSourceService, MultiDB
|
|||||||
)
|
)
|
||||||
return description
|
return description
|
||||||
|
|
||||||
|
def get_location_path(self, table_name: str, schema_name: str) -> Optional[str]:
|
||||||
|
"""
|
||||||
|
Method to fetch the location path of the table
|
||||||
|
"""
|
||||||
|
return self.external_location_map.get(
|
||||||
|
(self.context.get().database, schema_name, table_name)
|
||||||
|
)
|
||||||
|
|
||||||
def _filter_owner_name(self, owner_name: str) -> str:
|
def _filter_owner_name(self, owner_name: str) -> str:
|
||||||
"""remove unnecessary keyword from name"""
|
"""remove unnecessary keyword from name"""
|
||||||
pattern = r"\(Unknown\)"
|
pattern = r"\(Unknown\)"
|
||||||
|
@ -1114,6 +1114,7 @@ public class TableRepository extends EntityRepository<Table> {
|
|||||||
recordChange("sourceUrl", original.getSourceUrl(), updated.getSourceUrl());
|
recordChange("sourceUrl", original.getSourceUrl(), updated.getSourceUrl());
|
||||||
recordChange("retentionPeriod", original.getRetentionPeriod(), updated.getRetentionPeriod());
|
recordChange("retentionPeriod", original.getRetentionPeriod(), updated.getRetentionPeriod());
|
||||||
recordChange("sourceHash", original.getSourceHash(), updated.getSourceHash());
|
recordChange("sourceHash", original.getSourceHash(), updated.getSourceHash());
|
||||||
|
recordChange("locationPath", original.getLocationPath(), updated.getLocationPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateConstraints(Table origTable, Table updatedTable) {
|
private void updateConstraints(Table origTable, Table updatedTable) {
|
||||||
|
@ -1232,6 +1232,7 @@ public class TableResource extends EntityResource<Table, TableRepository> {
|
|||||||
.copy(new Table(), create, user)
|
.copy(new Table(), create, user)
|
||||||
.withColumns(create.getColumns())
|
.withColumns(create.getColumns())
|
||||||
.withSourceUrl(create.getSourceUrl())
|
.withSourceUrl(create.getSourceUrl())
|
||||||
|
.withLocationPath(create.getLocationPath())
|
||||||
.withTableConstraints(create.getTableConstraints())
|
.withTableConstraints(create.getTableConstraints())
|
||||||
.withTablePartition(create.getTablePartition())
|
.withTablePartition(create.getTablePartition())
|
||||||
.withTableType(create.getTableType())
|
.withTableType(create.getTableType())
|
||||||
|
@ -98,6 +98,7 @@ public record TableIndex(Table table) implements ColumnIndex {
|
|||||||
doc.put("schema_suggest", schemaSuggest);
|
doc.put("schema_suggest", schemaSuggest);
|
||||||
doc.put("database_suggest", databaseSuggest);
|
doc.put("database_suggest", databaseSuggest);
|
||||||
doc.put("serviceType", table.getServiceType());
|
doc.put("serviceType", table.getServiceType());
|
||||||
|
doc.put("locationPath", table.getLocationPath());
|
||||||
doc.put("service", getEntityWithDisplayName(table.getService()));
|
doc.put("service", getEntityWithDisplayName(table.getService()));
|
||||||
doc.put("database", getEntityWithDisplayName(table.getDatabase()));
|
doc.put("database", getEntityWithDisplayName(table.getDatabase()));
|
||||||
doc.put("lineage", SearchIndex.getLineageData(table.getEntityReference()));
|
doc.put("lineage", SearchIndex.getLineageData(table.getEntityReference()));
|
||||||
|
@ -499,6 +499,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"locationPath": {
|
||||||
|
"type": "text"
|
||||||
|
},
|
||||||
"usageSummary": {
|
"usageSummary": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"dailyStats": {
|
"dailyStats": {
|
||||||
|
@ -477,6 +477,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"locationPath": {
|
||||||
|
"type": "text"
|
||||||
|
},
|
||||||
"usageSummary": {
|
"usageSummary": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"dailyStats": {
|
"dailyStats": {
|
||||||
|
@ -452,6 +452,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"locationPath": {
|
||||||
|
"type": "text"
|
||||||
|
},
|
||||||
"usageSummary": {
|
"usageSummary": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"dailyStats": {
|
"dailyStats": {
|
||||||
|
@ -34,6 +34,11 @@
|
|||||||
"dataModel": {
|
"dataModel": {
|
||||||
"$ref": "../../entity/data/table.json#/definitions/dataModel"
|
"$ref": "../../entity/data/table.json#/definitions/dataModel"
|
||||||
},
|
},
|
||||||
|
"locationPath": {
|
||||||
|
"description": "Full storage path in case of external and managed tables.",
|
||||||
|
"type": "string",
|
||||||
|
"default": null
|
||||||
|
},
|
||||||
"tableConstraints": {
|
"tableConstraints": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
|
@ -996,6 +996,11 @@
|
|||||||
"description": "Reference to the Location that contains this table.",
|
"description": "Reference to the Location that contains this table.",
|
||||||
"$ref": "../../type/entityReference.json"
|
"$ref": "../../type/entityReference.json"
|
||||||
},
|
},
|
||||||
|
"locationPath": {
|
||||||
|
"description": "Full storage path in case of external and managed tables.",
|
||||||
|
"type": "string",
|
||||||
|
"default": null
|
||||||
|
},
|
||||||
"schemaDefinition": {
|
"schemaDefinition": {
|
||||||
"description": "DDL for Tables and Views",
|
"description": "DDL for Tables and Views",
|
||||||
"$ref": "../../type/basic.json#/definitions/sqlQuery"
|
"$ref": "../../type/basic.json#/definitions/sqlQuery"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user