getTable method

Future<GetTableResponse> getTable({
  1. required String databaseName,
  2. required String name,
  3. AuditContext? auditContext,
  4. String? catalogId,
  5. bool? includeStatusDetails,
  6. DateTime? queryAsOfTime,
  7. String? transactionId,
})

Retrieves the Table definition in a Data Catalog for a specified table.

May throw EntityNotFoundException. May throw FederationSourceException. May throw FederationSourceRetryableException. May throw GlueEncryptionException. May throw InternalServiceException. May throw InvalidInputException. May throw OperationTimeoutException. May throw ResourceNotReadyException.

Parameter databaseName : The name of the database in the catalog in which the table resides. For Hive compatibility, this name is entirely lowercase.

Parameter name : The name of the table for which to retrieve the definition. For Hive compatibility, this name is entirely lowercase.

Parameter auditContext : A structure containing the Lake Formation audit context.

Parameter catalogId : The ID of the Data Catalog where the table resides. If none is provided, the Amazon Web Services account ID is used by default.

Parameter includeStatusDetails : Specifies whether to include status details related to a request to create or update an Glue Data Catalog view.

Parameter queryAsOfTime : The time as of when to read the table contents. If not set, the most recent transaction commit time will be used. Cannot be specified along with TransactionId.

Parameter transactionId : The transaction ID at which to read the table contents.

Implementation

Future<GetTableResponse> getTable({
  required String databaseName,
  required String name,
  AuditContext? auditContext,
  String? catalogId,
  bool? includeStatusDetails,
  DateTime? queryAsOfTime,
  String? transactionId,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSGlue.GetTable'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DatabaseName': databaseName,
      'Name': name,
      if (auditContext != null) 'AuditContext': auditContext,
      if (catalogId != null) 'CatalogId': catalogId,
      if (includeStatusDetails != null)
        'IncludeStatusDetails': includeStatusDetails,
      if (queryAsOfTime != null)
        'QueryAsOfTime': unixTimestampToJson(queryAsOfTime),
      if (transactionId != null) 'TransactionId': transactionId,
    },
  );

  return GetTableResponse.fromJson(jsonResponse.body);
}