getTables method

Future<GetTablesResponse> getTables({
  1. required String databaseName,
  2. List<TableAttributes>? attributesToGet,
  3. AuditContext? auditContext,
  4. String? catalogId,
  5. String? expression,
  6. bool? includeStatusDetails,
  7. int? maxResults,
  8. String? nextToken,
  9. DateTime? queryAsOfTime,
  10. String? transactionId,
})

Retrieves the definitions of some or all of the tables in a given Database.

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

Parameter databaseName : The database in the catalog whose tables to list. For Hive compatibility, this name is entirely lowercase.

Parameter attributesToGet : Specifies the table fields returned by the GetTables call. This parameter doesn’t accept an empty list. The request must include NAME.

The following are the valid combinations of values:

  • NAME - Names of all tables in the database.
  • NAME, TABLE_TYPE - Names of all tables and the table types.

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

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

Parameter expression : A regular expression pattern. If present, only those tables whose names match the pattern are returned.

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

Parameter maxResults : The maximum number of tables to return in a single response.

Parameter nextToken : A continuation token, included if this is a continuation call.

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<GetTablesResponse> getTables({
  required String databaseName,
  List<TableAttributes>? attributesToGet,
  AuditContext? auditContext,
  String? catalogId,
  String? expression,
  bool? includeStatusDetails,
  int? maxResults,
  String? nextToken,
  DateTime? queryAsOfTime,
  String? transactionId,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSGlue.GetTables'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DatabaseName': databaseName,
      if (attributesToGet != null)
        'AttributesToGet': attributesToGet.map((e) => e.value).toList(),
      if (auditContext != null) 'AuditContext': auditContext,
      if (catalogId != null) 'CatalogId': catalogId,
      if (expression != null) 'Expression': expression,
      if (includeStatusDetails != null)
        'IncludeStatusDetails': includeStatusDetails,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (queryAsOfTime != null)
        'QueryAsOfTime': unixTimestampToJson(queryAsOfTime),
      if (transactionId != null) 'TransactionId': transactionId,
    },
  );

  return GetTablesResponse.fromJson(jsonResponse.body);
}