in metacat-main/src/main/java/com/netflix/metacat/main/api/v1/MetacatController.java [613:674]
public TableDto getTable(
@Parameter(description = "The name of the catalog", required = true)
@PathVariable("catalog-name") final String catalogName,
@Parameter(description = "The name of the database", required = true)
@PathVariable("database-name") final String databaseName,
@Parameter(description = "The name of the table", required = true)
@PathVariable("table-name") final String tableName,
@Parameter(
description = "Whether to include the core information about the table (location, serde, columns) in "
+ "the response. You would only say false here if you only want metadata."
)
@RequestParam(name = "includeInfo", defaultValue = "true") final boolean includeInfo,
@Parameter(description = "Whether to include user definition metadata information to the response")
@RequestParam(
name = "includeDefinitionMetadata",
defaultValue = "true"
) final boolean includeDefinitionMetadata,
@Parameter(description = "Whether to include user data metadata information to the response")
@RequestParam(name = "includeDataMetadata", defaultValue = "true") final boolean includeDataMetadata,
@Parameter(description = "Whether to include more info details to the response. This value is considered only "
+ "if includeInfo is true.")
@RequestParam(name = "includeInfoDetails", defaultValue = "false") final boolean includeInfoDetails,
@Parameter(description = "Whether to include only the metadata location in the response")
@RequestParam(
name = "includeMetadataLocationOnly",
defaultValue = "false") final boolean includeMetadataLocationOnly
) {
final Supplier<QualifiedName> qualifiedNameSupplier =
() -> QualifiedName.ofTable(catalogName, databaseName, tableName);
final QualifiedName name = this.requestWrapper.qualifyName(qualifiedNameSupplier);
return this.requestWrapper.processRequest(
name,
"getTable",
ImmutableMap.<String, String>builder()
.put("includeInfo", String.valueOf(includeInfo))
.put("includeDefinitionMetadata", String.valueOf(includeDefinitionMetadata))
.put("includeDataMetadata", String.valueOf(includeDataMetadata))
.put("includeMetadataFromConnector", String.valueOf(includeInfoDetails))
.put("includeMetadataLocationOnly", String.valueOf(includeMetadataLocationOnly))
.build(),
() -> {
final Optional<TableDto> table = this.tableService.get(
name,
GetTableServiceParameters.builder()
.includeInfo(includeInfo)
.includeDefinitionMetadata(includeDefinitionMetadata)
.includeDataMetadata(includeDataMetadata)
.disableOnReadMetadataIntercetor(false)
.includeMetadataFromConnector(includeInfoDetails)
.includeMetadataLocationOnly(includeMetadataLocationOnly)
.useCache(true)
.build()
);
final TableDto tableDto = table.orElseThrow(() -> new TableNotFoundException(name));
// Set the name to whatever the request was for because
// for aliases, this could've been set to the original name
tableDto.setName(qualifiedNameSupplier.get());
return tableDto;
}
);
}