getTableMetadata method

Future<GetTableMetadataOutput> getTableMetadata({
  1. required String catalogName,
  2. required String databaseName,
  3. required String tableName,
  4. String? workGroup,
})

Returns table metadata for the specified catalog, database, and table.

May throw InternalServerException. May throw InvalidRequestException. May throw MetadataException.

Parameter catalogName : The name of the data catalog that contains the database and table metadata to return.

Parameter databaseName : The name of the database that contains the table metadata to return.

Parameter tableName : The name of the table for which metadata is returned.

Parameter workGroup : The name of the workgroup for which the metadata is being fetched. Required if requesting an IAM Identity Center enabled Glue Data Catalog.

Implementation

Future<GetTableMetadataOutput> getTableMetadata({
  required String catalogName,
  required String databaseName,
  required String tableName,
  String? workGroup,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonAthena.GetTableMetadata'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'CatalogName': catalogName,
      'DatabaseName': databaseName,
      'TableName': tableName,
      if (workGroup != null) 'WorkGroup': workGroup,
    },
  );

  return GetTableMetadataOutput.fromJson(jsonResponse.body);
}