getTable method

Future<GetTableResponse> getTable({
  1. required String databaseName,
  2. required String name,
  3. String? catalogId,
})

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

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

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 catalogId : The ID of the Data Catalog where the table resides. If none is provided, the AWS account ID is used by default.

Implementation

Future<GetTableResponse> getTable({
  required String databaseName,
  required String name,
  String? catalogId,
}) async {
  ArgumentError.checkNotNull(databaseName, 'databaseName');
  _s.validateStringLength(
    'databaseName',
    databaseName,
    1,
    255,
    isRequired: true,
  );
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    255,
    isRequired: true,
  );
  _s.validateStringLength(
    'catalogId',
    catalogId,
    1,
    255,
  );
  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 (catalogId != null) 'CatalogId': catalogId,
    },
  );

  return GetTableResponse.fromJson(jsonResponse.body);
}