Skip to content

DynamoDBClient.create_table

rboto-dynamodb==0.4.0 · Service index · Types

Model summary (excerpt): The CreateTable operation adds a new table to your account. In an Amazon Web Services account, table names must be unique within each Region. That is, you can have two tables with same name if you create the tables in different Regions. CreateTable is an asynchronous operation. Upon receiving a CreateTable request, DynamoDB immediately returns a response with a TableStatus of CREATING . After...

Install and imports

python -m pip install "rboto[dynamodb]==0.4.0"
from rboto import DynamoDBClient
from collections.abc import Sequence
from rboto_dynamodb.types import (
    AttributeDefinition,
    BillingMode,
    CreateTableOutput,
    GlobalSecondaryIndex,
    GlobalTableSettingsReplicationMode,
    KeySchemaElement,
    LocalSecondaryIndex,
    OnDemandThroughput,
    ProvisionedThroughput,
    SSESpecification,
    StreamSpecification,
    TableClass,
    Tag,
    VectorIndex,
    WarmThroughput,
)

Signature

async def create_table(
    *,
    table_name: str,
    attribute_definitions: Sequence[AttributeDefinition] | None = None,
    key_schema: Sequence[KeySchemaElement] | None = None,
    local_secondary_indexes: Sequence[LocalSecondaryIndex] | None = None,
    global_secondary_indexes: Sequence[GlobalSecondaryIndex] | None = None,
    billing_mode: BillingMode | None = None,
    provisioned_throughput: ProvisionedThroughput | None = None,
    stream_specification: StreamSpecification | None = None,
    sse_specification: SSESpecification | None = None,
    tags: Sequence[Tag] | None = None,
    table_class: TableClass | None = None,
    deletion_protection_enabled: bool | None = None,
    warm_throughput: WarmThroughput | None = None,
    resource_policy: str | None = None,
    on_demand_throughput: OnDemandThroughput | None = None,
    global_table_source_arn: str | None = None,
    global_table_settings_replication_mode: GlobalTableSettingsReplicationMode | None = None,
    vector_indexes: Sequence[VectorIndex] | None = None,
) -> CreateTableOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
table_name Yes The name of the table to create. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.
attribute_definitions No An array of attributes that describe the key schema for the table and indexes.
key_schema No Specifies the attributes that make up the primary key for a table or an index. The attributes in KeySchema must also be defined in the AttributeDefinitions array. For more information, see Data Model in the Amazon DynamoDB Developer Guide . Each KeySchemaElement in the array is composed of: AttributeName - The name of this key attribute. KeyType - The role that the key attribute will assume:...
local_secondary_indexes No One or more local secondary indexes (the maximum is 5) to be created on the table. Each index is scoped to a given partition key value. There is a 10 GB size limit per partition key value; otherwise, the size of a local secondary index is unconstrained. Each local secondary index in the array includes the following: IndexName - The name of the local secondary index. Must be unique only for...
global_secondary_indexes No One or more global secondary indexes (the maximum is 20) to be created on the table. Each global secondary index in the array includes the following: IndexName - The name of the global secondary index. Must be unique only for this table. KeySchema - Specifies the key schema for the global secondary index. Each global secondary index supports up to 4 partition keys and up to 4 sort keys....
billing_mode No Controls how you are charged for read and write throughput and how you manage capacity. This setting can be changed later. PAY_PER_REQUEST - We recommend using PAY_PER_REQUEST for most DynamoDB workloads. PAY_PER_REQUEST sets the billing mode to On-demand capacity mode . PROVISIONED - We recommend using PROVISIONED for steady workloads with predictable growth where capacity requirements can be...
provisioned_throughput No Represents the provisioned throughput settings for a specified table or index. The settings can be modified using the UpdateTable operation. If you set BillingMode as PROVISIONED , you must specify this property. If you set BillingMode as PAY_PER_REQUEST , you cannot specify this property. For current minimum and maximum provisioned throughput values, see Service, Account, and Table Quotas in...
stream_specification No The settings for DynamoDB Streams on the table. These settings consist of: StreamEnabled - Indicates whether DynamoDB Streams is to be enabled (true) or disabled (false). StreamViewType - When an item in the table is modified, StreamViewType determines what information is written to the table's stream. Valid values for StreamViewType are: KEYS_ONLY - Only the key attributes of the modified...
sse_specification No Represents the settings used to enable server-side encryption.
tags No A list of key-value pairs to label the table. For more information, see Tagging for DynamoDB .
table_class No The table class of the new table. Valid values are STANDARD and STANDARD_INFREQUENT_ACCESS .
deletion_protection_enabled No Indicates whether deletion protection is to be enabled (true) or disabled (false) on the table.
warm_throughput No Represents the warm throughput (in read units per second and write units per second) for creating a table.
resource_policy No An Amazon Web Services resource-based policy document in JSON format that will be attached to the table. When you attach a resource-based policy while creating a table, the policy application is strongly consistent . The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit. For a full list of...
on_demand_throughput No Sets the maximum number of read and write units for the specified table in on-demand capacity mode. If you use this parameter, you must specify MaxReadRequestUnits , MaxWriteRequestUnits , or both.
global_table_source_arn No The Amazon Resource Name (ARN) of the source table used for the creation of a multi-account global table.
global_table_settings_replication_mode No Controls the settings synchronization mode for the global table. For multi-account global tables, this parameter is required and the only supported value is ENABLED. For same-account global tables, this parameter is set to ENABLED_WITH_OVERRIDES.
vector_indexes No One or more vector indexes to be created on the table. Each vector index enables similarity search on a vector attribute. Each element in the list consists of: IndexName - The name of the vector index. Must be unique within the table. VectorAttribute - The attribute that contains vector embeddings. If multiple vector indexes reference the same attribute, they must all use the same number of...

Output

CreateTableOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
table_description TableDescriptionOutput | None Always present TableDescriptionOutput

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

AttributeDefinition, BillingMode, CreateTableOutput, GlobalSecondaryIndex, GlobalTableSettingsReplicationMode, KeySchemaElement, LocalSecondaryIndex, OnDemandThroughput, ProvisionedThroughput, SSESpecification, StreamSpecification, TableClass, Tag, VectorIndex, WarmThroughput

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

No generated paginator for this operation.

No output stream.

Errors

Import from rboto_dynamodb.exceptions:

InternalServerError, InvalidEndpointError, LimitExceededError, ResourceInUseError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model