getTables method

Future<GetTablesResponse> getTables({
  1. required String databaseName,
  2. String? catalogId,
  3. String? expression,
  4. int? maxResults,
  5. String? nextToken,
})

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

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

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

Parameter catalogId : The ID of the Data Catalog where the tables reside. If none is provided, the AWS 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 maxResults : The maximum number of tables to return in a single response.

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

Implementation

Future<GetTablesResponse> getTables({
  required String databaseName,
  String? catalogId,
  String? expression,
  int? maxResults,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(databaseName, 'databaseName');
  _s.validateStringLength(
    'databaseName',
    databaseName,
    1,
    255,
    isRequired: true,
  );
  _s.validateStringLength(
    'catalogId',
    catalogId,
    1,
    255,
  );
  _s.validateStringLength(
    'expression',
    expression,
    0,
    2048,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1000,
  );
  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 (catalogId != null) 'CatalogId': catalogId,
      if (expression != null) 'Expression': expression,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return GetTablesResponse.fromJson(jsonResponse.body);
}