MINOR: Add location path to table entity (#18307)

This commit is contained in:
Mayur Singal 2024-10-21 10:31:27 +05:30 committed by ulixius9
parent 0741788744
commit 5801e6c380
10 changed files with 39 additions and 0 deletions

View File

@ -478,6 +478,12 @@ class CommonDbSourceService(
"""Not Implemented"""
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()
def yield_table(
self, table_name_and_type: Tuple[str, TableType]
@ -553,6 +559,9 @@ class CommonDbSourceService(
table_type=table_type,
),
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(

View File

@ -705,6 +705,14 @@ class DatabricksSource(ExternalTableLineageMixin, CommonDbSourceService, MultiDB
)
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:
"""remove unnecessary keyword from name"""
pattern = r"\(Unknown\)"

View File

@ -1114,6 +1114,7 @@ public class TableRepository extends EntityRepository<Table> {
recordChange("sourceUrl", original.getSourceUrl(), updated.getSourceUrl());
recordChange("retentionPeriod", original.getRetentionPeriod(), updated.getRetentionPeriod());
recordChange("sourceHash", original.getSourceHash(), updated.getSourceHash());
recordChange("locationPath", original.getLocationPath(), updated.getLocationPath());
}
private void updateConstraints(Table origTable, Table updatedTable) {

View File

@ -1232,6 +1232,7 @@ public class TableResource extends EntityResource<Table, TableRepository> {
.copy(new Table(), create, user)
.withColumns(create.getColumns())
.withSourceUrl(create.getSourceUrl())
.withLocationPath(create.getLocationPath())
.withTableConstraints(create.getTableConstraints())
.withTablePartition(create.getTablePartition())
.withTableType(create.getTableType())

View File

@ -98,6 +98,7 @@ public record TableIndex(Table table) implements ColumnIndex {
doc.put("schema_suggest", schemaSuggest);
doc.put("database_suggest", databaseSuggest);
doc.put("serviceType", table.getServiceType());
doc.put("locationPath", table.getLocationPath());
doc.put("service", getEntityWithDisplayName(table.getService()));
doc.put("database", getEntityWithDisplayName(table.getDatabase()));
doc.put("lineage", SearchIndex.getLineageData(table.getEntityReference()));

View File

@ -499,6 +499,9 @@
}
}
},
"locationPath": {
"type": "text"
},
"usageSummary": {
"properties": {
"dailyStats": {

View File

@ -477,6 +477,9 @@
}
}
},
"locationPath": {
"type": "text"
},
"usageSummary": {
"properties": {
"dailyStats": {

View File

@ -452,6 +452,9 @@
}
}
},
"locationPath": {
"type": "text"
},
"usageSummary": {
"properties": {
"dailyStats": {

View File

@ -34,6 +34,11 @@
"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": {
"type": "array",
"items": {

View File

@ -996,6 +996,11 @@
"description": "Reference to the Location that contains this table.",
"$ref": "../../type/entityReference.json"
},
"locationPath": {
"description": "Full storage path in case of external and managed tables.",
"type": "string",
"default": null
},
"schemaDefinition": {
"description": "DDL for Tables and Views",
"$ref": "../../type/basic.json#/definitions/sqlQuery"