batchDeleteTable method

Future<BatchDeleteTableResponse> batchDeleteTable({
  1. required String databaseName,
  2. required List<String> tablesToDelete,
  3. String? catalogId,
})

Deletes multiple tables at once.

To ensure the immediate deletion of all related resources, before calling BatchDeleteTable, use DeleteTableVersion or BatchDeleteTableVersion, and DeletePartition or BatchDeletePartition, to delete any resources that belong to the table.

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

Parameter databaseName : The name of the catalog database in which the tables to delete reside. For Hive compatibility, this name is entirely lowercase.

Parameter tablesToDelete : A list of the table to delete.

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<BatchDeleteTableResponse> batchDeleteTable({
  required String databaseName,
  required List<String> tablesToDelete,
  String? catalogId,
}) async {
  ArgumentError.checkNotNull(databaseName, 'databaseName');
  _s.validateStringLength(
    'databaseName',
    databaseName,
    1,
    255,
    isRequired: true,
  );
  ArgumentError.checkNotNull(tablesToDelete, 'tablesToDelete');
  _s.validateStringLength(
    'catalogId',
    catalogId,
    1,
    255,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSGlue.BatchDeleteTable'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DatabaseName': databaseName,
      'TablesToDelete': tablesToDelete,
      if (catalogId != null) 'CatalogId': catalogId,
    },
  );

  return BatchDeleteTableResponse.fromJson(jsonResponse.body);
}