createTable method

Future<void> createTable({
  1. required String databaseName,
  2. required TableInput tableInput,
  3. String? catalogId,
  4. List<PartitionIndex>? partitionIndexes,
})

Creates a new table definition in the Data Catalog.

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

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

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

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

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

Implementation

Future<void> createTable({
  required String databaseName,
  required TableInput tableInput,
  String? catalogId,
  List<PartitionIndex>? partitionIndexes,
}) async {
  ArgumentError.checkNotNull(databaseName, 'databaseName');
  _s.validateStringLength(
    'databaseName',
    databaseName,
    1,
    255,
    isRequired: true,
  );
  ArgumentError.checkNotNull(tableInput, 'tableInput');
  _s.validateStringLength(
    'catalogId',
    catalogId,
    1,
    255,
  );
  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,
      'TableInput': tableInput,
      if (catalogId != null) 'CatalogId': catalogId,
      if (partitionIndexes != null) 'PartitionIndexes': partitionIndexes,
    },
  );
}