CreatePartitionCommand

Creates a new partition.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { GlueClient, CreatePartitionCommand } from "@aws-sdk/client-glue"; // ES Modules import
// const { GlueClient, CreatePartitionCommand } = require("@aws-sdk/client-glue"); // CommonJS import
const client = new GlueClient(config);
const input = { // CreatePartitionRequest
  CatalogId: "STRING_VALUE",
  DatabaseName: "STRING_VALUE", // required
  TableName: "STRING_VALUE", // required
  PartitionInput: { // PartitionInput
    Values: [ // ValueStringList
      "STRING_VALUE",
    ],
    LastAccessTime: new Date("TIMESTAMP"),
    StorageDescriptor: { // StorageDescriptor
      Columns: [ // ColumnList
        { // Column
          Name: "STRING_VALUE", // required
          Type: "STRING_VALUE",
          Comment: "STRING_VALUE",
          Parameters: { // ParametersMap
            "<keys>": "STRING_VALUE",
          },
        },
      ],
      Location: "STRING_VALUE",
      AdditionalLocations: [ // LocationStringList
        "STRING_VALUE",
      ],
      InputFormat: "STRING_VALUE",
      OutputFormat: "STRING_VALUE",
      Compressed: true || false,
      NumberOfBuckets: Number("int"),
      SerdeInfo: { // SerDeInfo
        Name: "STRING_VALUE",
        SerializationLibrary: "STRING_VALUE",
        Parameters: {
          "<keys>": "STRING_VALUE",
        },
      },
      BucketColumns: [ // NameStringList
        "STRING_VALUE",
      ],
      SortColumns: [ // OrderList
        { // Order
          Column: "STRING_VALUE", // required
          SortOrder: Number("int"), // required
        },
      ],
      Parameters: "<ParametersMap>",
      SkewedInfo: { // SkewedInfo
        SkewedColumnNames: [
          "STRING_VALUE",
        ],
        SkewedColumnValues: [ // ColumnValueStringList
          "STRING_VALUE",
        ],
        SkewedColumnValueLocationMaps: { // LocationMap
          "<keys>": "STRING_VALUE",
        },
      },
      StoredAsSubDirectories: true || false,
      SchemaReference: { // SchemaReference
        SchemaId: { // SchemaId
          SchemaArn: "STRING_VALUE",
          SchemaName: "STRING_VALUE",
          RegistryName: "STRING_VALUE",
        },
        SchemaVersionId: "STRING_VALUE",
        SchemaVersionNumber: Number("long"),
      },
    },
    Parameters: "<ParametersMap>",
    LastAnalyzedTime: new Date("TIMESTAMP"),
  },
};
const command = new CreatePartitionCommand(input);
const response = await client.send(command);
// {};

CreatePartitionCommand Input

See CreatePartitionCommandInput for more details

Parameter
Type
Description
DatabaseName
Required
string | undefined

The name of the metadata database in which the partition is to be created.

PartitionInput
Required
PartitionInput | undefined

A PartitionInput structure defining the partition to be created.

TableName
Required
string | undefined

The name of the metadata table in which the partition is to be created.

CatalogId
string | undefined

The Amazon Web Services account ID of the catalog in which the partition is to be created.

CreatePartitionCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.

Throws

Name
Fault
Details
AlreadyExistsException
client

A resource to be created or added already exists.

EntityNotFoundException
client

A specified entity does not exist

GlueEncryptionException
client

An encryption operation failed.

InternalServiceException
server

An internal service error occurred.

InvalidInputException
client

The input provided was not valid.

OperationTimeoutException
client

The operation timed out.

ResourceNumberLimitExceededException
client

A resource numerical limit was exceeded.

GlueServiceException
Base exception class for all service exceptions from Glue service.