-
Notifications
You must be signed in to change notification settings - Fork 4
3.1 DDL (CREATE TABLE)
Peng Ren edited this page Oct 15, 2022
·
6 revisions
CREATE [GLOBAL] TABLE tbl_name
[(create_definition, ...)]
[table_options]
create_definition: {
col_name column_definition
| INDEX index_name index_type
(col_name key_type, ...)
[index_option] ...
}
column_definition: {
data_type [key_type]
}
key_type : {
PARTITION KEY | SORT KEY | HASH | RANGE
}
data_type: {
NUMERIC | STRING | BINARY
}
index_type:
{GLOBAL | LOCAL}
index_option: {
Projection.ProjectionType [=] {ALL | KEYS_ONLY | INCLUDE}
| Projection.NonKeyAttributes [=] ('string', ...)
| ProvisionedThroughput.ReadCapacityUnits [=] value
| ProvisionedThroughput.WriteCapacityUnits [=] value
}
table_options:
table_option [[,] table_option] ...
table_option: {
BillingMode [=] {PROVISIONED | PAY_PER_REQUEST}
| ProvisionedThroughput.ReadCapacityUnits [=] value
| ProvisionedThroughput.WriteCapacityUnits [=] value
| StreamSpecification.StreamEnabled [=] {True | False}
| StreamSpecification.StreamViewType [=] {NEW_IMAGE | OLD_IMAGE | NEW_AND_OLD_IMAGES | KEYS_ONLY}
| SSESpecification.Enabled [=] {True | False}
| SSESpecification.SSEType [=] {AES256 | KMS}
| SSESpecification.KMSMasterKeyId [=] value
| TableClass [=] {STANDARD | STANDARD_INFREQUENT_ACCESS}
| Tags [=] (tags)
| ReplicationGroup [=] ('string', ...)
}
tags:
key:value, ...CREATE TABLE Issues (
IssueId numeric PARTITION KEY,
Title string SORT KEY,
CreateDate string,
DueDate string,
INDEX CreateDateIndex GLOBAL (
CreateDate PARTITION KEY,
IssueId SORT KEY
)
Projection.ProjectionType INCLUDE
Projection.NonKeyAttributes (Description, Status)
ProvisionedThroughput.ReadCapacityUnits 1
ProvisionedThroughput.WriteCapacityUnits 1,
INDEX DueDateIndex GLOBAL (
DueDate PARTITION KEY
)
Projection.ProjectionType ALL
ProvisionedThroughput.ReadCapacityUnits 1
ProvisionedThroughput.WriteCapacityUnits 1,
)
BillingMode PROVISIONED
ProvisionedThroughput.ReadCapacityUnits 1
ProvisionedThroughput.WriteCapacityUnits 1
StreamSpecification.StreamEnabled False
SSESpecification.Enabled False
TableClass STANDARD
Tags (name:Issue, usage:test)CREATE GLOBAL TABLE Issues
ReplicationGroup (us-east-1, us-west-2)Please refer to boto3 API: