createTable method

Future<void> createTable({
  1. required String databaseName,
  2. String? catalogId,
  3. String? name,
  4. OpenTableFormatInput? openTableFormatInput,
  5. List<PartitionIndex>? partitionIndexes,
  6. TableInput? tableInput,
  7. String? transactionId,
})

Creates a new table definition in the Data Catalog.

May throw AlreadyExistsException. May throw ConcurrentModificationException. May throw EntityNotFoundException. May throw FederationSourceException. May throw FederationSourceRetryableException. May throw GlueEncryptionException. May throw InternalServiceException. May throw InvalidInputException. May throw OperationTimeoutException. May throw ResourceNotReadyException. May throw ResourceNumberLimitExceededException.

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

Parameter catalogId : The ID of the Data Catalog in which to create the Table. If none is supplied, the Amazon Web Services account ID is used by default.

Parameter name : The unique identifier for the table within the specified database that will be created in the Glue Data Catalog.

Parameter openTableFormatInput : Specifies an OpenTableFormatInput structure when creating an open format table.

Parameter partitionIndexes : A list of partition indexes, PartitionIndex structures, to create in the table.

Parameter tableInput : The TableInput object that defines the metadata table to create in the catalog.

Parameter transactionId : The ID of the transaction.

Implementation

Future<void> createTable({
  required String databaseName,
  String? catalogId,
  String? name,
  OpenTableFormatInput? openTableFormatInput,
  List<PartitionIndex>? partitionIndexes,
  TableInput? tableInput,
  String? transactionId,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSGlue.CreateTable'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DatabaseName': databaseName,
      if (catalogId != null) 'CatalogId': catalogId,
      if (name != null) 'Name': name,
      if (openTableFormatInput != null)
        'OpenTableFormatInput': openTableFormatInput,
      if (partitionIndexes != null) 'PartitionIndexes': partitionIndexes,
      if (tableInput != null) 'TableInput': tableInput,
      if (transactionId != null) 'TransactionId': transactionId,
    },
  );
}