Class: Aws::DynamoDB::Table
- Inherits:
-
Object
- Object
- Aws::DynamoDB::Table
- Extended by:
- Aws::Deprecations
- Defined in:
- lib/aws-sdk-dynamodb/table.rb
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#attribute_definitions ⇒ Array<Types::AttributeDefinition>
An array of ‘AttributeDefinition` objects.
-
#creation_date_time ⇒ Time
The date and time when the table was created, in [UNIX epoch time] format.
-
#global_secondary_indexes ⇒ Array<Types::GlobalSecondaryIndexDescription>
The global secondary indexes, if any, on the table.
-
#item_count ⇒ Integer
The number of items in the specified table.
-
#key_schema ⇒ Array<Types::KeySchemaElement>
The primary key structure for the table.
-
#latest_stream_arn ⇒ String
The Amazon Resource Name (ARN) that uniquely identifies the latest stream for this table.
-
#latest_stream_label ⇒ String
A timestamp, in ISO 8601 format, for this stream.
-
#local_secondary_indexes ⇒ Array<Types::LocalSecondaryIndexDescription>
Represents one or more local secondary indexes on the table.
- #name ⇒ String (also: #table_name)
-
#provisioned_throughput ⇒ Types::ProvisionedThroughputDescription
The provisioned throughput settings for the table, consisting of read and write capacity units, along with data about increases and decreases.
-
#stream_specification ⇒ Types::StreamSpecification
The current DynamoDB Streams configuration for the table.
-
#table_arn ⇒ String
The Amazon Resource Name (ARN) that uniquely identifies the table.
-
#table_size_bytes ⇒ Integer
The total size of the specified table, in bytes.
-
#table_status ⇒ String
The current state of the table:.
Actions collapse
- #delete(options = {}) ⇒ Types::DeleteTableOutput
- #delete_item(options = {}) ⇒ Types::DeleteItemOutput
- #get_item(options = {}) ⇒ Types::GetItemOutput
- #identifiers ⇒ Object deprecated private Deprecated.
- #put_item(options = {}) ⇒ Types::PutItemOutput
- #query(options = {}) ⇒ Types::QueryOutput
- #scan(options = {}) ⇒ Types::ScanOutput
- #update(options = {}) ⇒ Table
- #update_item(options = {}) ⇒ Types::UpdateItemOutput
Instance Method Summary collapse
- #client ⇒ Client
-
#data ⇒ Types::TableDescription
Returns the data for this Table.
-
#data_loaded? ⇒ Boolean
Returns ‘true` if this resource is loaded.
-
#initialize(*args) ⇒ Table
constructor
A new instance of Table.
- #load ⇒ self (also: #reload)
Constructor Details
#initialize(name, options = {}) ⇒ Table #initialize(options = {}) ⇒ Table
Returns a new instance of Table.
19 20 21 22 23 24 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 19 def initialize(*args) = Hash === args.last ? args.pop.dup : {} @name = extract_name(args, ) @data = .delete(:data) @client = .delete(:client) || Client.new() end |
Instance Method Details
#attribute_definitions ⇒ Array<Types::AttributeDefinition>
An array of ‘AttributeDefinition` objects. Each of these objects describes one attribute in the table and index key schema.
Each ‘AttributeDefinition` object in this array is composed of:
-
‘AttributeName` - The name of the attribute.
-
‘AttributeType` - The data type for the attribute.
43 44 45 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 43 def attribute_definitions data.attribute_definitions end |
#client ⇒ Client
291 292 293 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 291 def client @client end |
#creation_date_time ⇒ Time
The date and time when the table was created, in [UNIX epoch time] format.
[1]: www.epochconverter.com/
102 103 104 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 102 def creation_date_time data.creation_date_time end |
#data ⇒ Types::TableDescription
Returns the data for this Aws::DynamoDB::Table. Calls Client#describe_table if #data_loaded? is ‘false`.
311 312 313 314 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 311 def data load unless @data @data end |
#data_loaded? ⇒ Boolean
319 320 321 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 319 def data_loaded? !!@data end |
#delete(options = {}) ⇒ Types::DeleteTableOutput
330 331 332 333 334 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 330 def delete( = {}) = .merge(table_name: @name) resp = @client.delete_table() resp.data end |
#delete_item(options = {}) ⇒ Types::DeleteItemOutput
521 522 523 524 525 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 521 def delete_item( = {}) = .merge(table_name: @name) resp = @client.delete_item() resp.data end |
#get_item(options = {}) ⇒ Types::GetItemOutput
645 646 647 648 649 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 645 def get_item( = {}) = .merge(table_name: @name) resp = @client.get_item() resp.data end |
#global_secondary_indexes ⇒ Array<Types::GlobalSecondaryIndexDescription>
The global secondary indexes, if any, on the table. Each index is scoped to a given partition key value. Each element is composed of:
-
‘Backfilling` - If true, then the index is currently in the backfilling phase. Backfilling occurs only when a new global secondary index is added to the table; it is the process by which DynamoDB populates the new index with data from the table. (This attribute does not appear for indexes that were created during a `CreateTable` operation.)
-
‘IndexName` - The name of the global secondary index.
-
‘IndexSizeBytes` - The total size of the global secondary index, in bytes. DynamoDB updates this value approximately every six hours. Recent changes might not be reflected in this value.
-
‘IndexStatus` - The current status of the global secondary index:
-
‘CREATING` - The index is being created.
-
‘UPDATING` - The index is being updated.
-
‘DELETING` - The index is being deleted.
-
‘ACTIVE` - The index is ready for use.
-
-
‘ItemCount` - The number of items in the global secondary index. DynamoDB updates this value approximately every six hours. Recent changes might not be reflected in this value.
-
‘KeySchema` - Specifies the complete index key schema. The attribute names in the key schema must be between 1 and 255 characters (inclusive). The key schema must begin with the same partition key as the table.
-
‘Projection` - Specifies attributes that are copied (projected) from the table into the index. These are in addition to the primary key attributes and index key attributes, which are automatically projected. Each attribute specification is composed of:
-
‘ProjectionType` - One of the following:
-
‘KEYS_ONLY` - Only the index and primary keys are projected into the index.
-
‘INCLUDE` - Only the specified table attributes are projected into the index. The list of projected attributes are in `NonKeyAttributes`.
-
‘ALL` - All of the table attributes are projected into the index.
-
-
‘NonKeyAttributes` - A list of one or more non-key attribute names that are projected into the secondary index. The total count of attributes provided in `NonKeyAttributes`, summed across all of the secondary indexes, must not exceed 20. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total.
-
-
‘ProvisionedThroughput` - The provisioned throughput settings for the global secondary index, consisting of read and write capacity units, along with data about increases and decreases.
If the table is in the ‘DELETING` state, no information about indexes will be returned.
254 255 256 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 254 def global_secondary_indexes data.global_secondary_indexes end |
#identifiers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
1954 1955 1956 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 1954 def identifiers { name: @name } end |
#item_count ⇒ Integer
The number of items in the specified table. DynamoDB updates this value approximately every six hours. Recent changes might not be reflected in this value.
126 127 128 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 126 def item_count data.item_count end |
#key_schema ⇒ Array<Types::KeySchemaElement>
The primary key structure for the table. Each ‘KeySchemaElement` consists of:
-
‘AttributeName` - The name of the attribute.
-
‘KeyType` - The role of the attribute:
-
‘HASH` - partition key
-
‘RANGE` - sort key
<note markdown=“1”> The partition key of an item is also known as its *hash attribute*. The term “hash attribute” derives from DynamoDB’ usage of an internal hash function to evenly distribute data items across partitions, based on their partition key values.
The sort key of an item is also known as its *range attribute*. The
term “range attribute” derives from the way DynamoDB stores items with the same partition key physically close together, in sorted order by the sort key value.
</note>
-
For more information about primary keys, see [Primary Key] in the *Amazon DynamoDB Developer Guide*.
[1]: docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataModel.html#DataModelPrimaryKey
77 78 79 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 77 def key_schema data.key_schema end |
#latest_stream_arn ⇒ String
The Amazon Resource Name (ARN) that uniquely identifies the latest stream for this table.
284 285 286 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 284 def latest_stream_arn data.latest_stream_arn end |
#latest_stream_label ⇒ String
A timestamp, in ISO 8601 format, for this stream.
Note that ‘LatestStreamLabel` is not a unique identifier for the stream, because it is possible that a stream from another table might have the same timestamp. However, the combination of the following three elements is guaranteed to be unique:
-
the AWS customer ID.
-
the table name.
-
the ‘StreamLabel`.
277 278 279 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 277 def latest_stream_label data.latest_stream_label end |
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::DynamoDB::Table. Returns ‘self` making it possible to chain methods.
table.reload.data
301 302 303 304 305 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 301 def load resp = @client.describe_table(table_name: @name) @data = resp.table self end |
#local_secondary_indexes ⇒ Array<Types::LocalSecondaryIndexDescription>
Represents one or more local secondary indexes on the table. Each index is scoped to a given partition key value. Tables with one or more local secondary indexes are subject to an item collection size limit, where the amount of data within a given item collection cannot exceed 10 GB. Each element is composed of:
-
‘IndexName` - The name of the local secondary index.
-
‘KeySchema` - Specifies the complete index key schema. The attribute names in the key schema must be between 1 and 255 characters (inclusive). The key schema must begin with the same partition key as the table.
-
‘Projection` - Specifies attributes that are copied (projected) from the table into the index. These are in addition to the primary key attributes and index key attributes, which are automatically projected. Each attribute specification is composed of:
-
‘ProjectionType` - One of the following:
-
‘KEYS_ONLY` - Only the index and primary keys are projected into the index.
-
‘INCLUDE` - Only the specified table attributes are projected into the index. The list of projected attributes are in `NonKeyAttributes`.
-
‘ALL` - All of the table attributes are projected into the index.
-
-
‘NonKeyAttributes` - A list of one or more non-key attribute names that are projected into the secondary index. The total count of attributes provided in `NonKeyAttributes`, summed across all of the secondary indexes, must not exceed 20. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total.
-
-
‘IndexSizeBytes` - Represents the total size of the index, in bytes. DynamoDB updates this value approximately every six hours. Recent changes might not be reflected in this value.
-
‘ItemCount` - Represents the number of items in the index. DynamoDB updates this value approximately every six hours. Recent changes might not be reflected in this value.
If the table is in the ‘DELETING` state, no information about indexes will be returned.
184 185 186 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 184 def local_secondary_indexes data.local_secondary_indexes end |
#name ⇒ String Also known as: table_name
29 30 31 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 29 def name @name end |
#provisioned_throughput ⇒ Types::ProvisionedThroughputDescription
The provisioned throughput settings for the table, consisting of read and write capacity units, along with data about increases and decreases.
110 111 112 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 110 def provisioned_throughput data.provisioned_throughput end |
#put_item(options = {}) ⇒ Types::PutItemOutput
851 852 853 854 855 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 851 def put_item( = {}) = .merge(table_name: @name) resp = @client.put_item() resp.data end |
#query(options = {}) ⇒ Types::QueryOutput
1236 1237 1238 1239 1240 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 1236 def query( = {}) = .merge(table_name: @name) resp = @client.query() resp.data end |
#scan(options = {}) ⇒ Types::ScanOutput
1549 1550 1551 1552 1553 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 1549 def scan( = {}) = .merge(table_name: @name) resp = @client.scan() resp.data end |
#stream_specification ⇒ Types::StreamSpecification
The current DynamoDB Streams configuration for the table.
260 261 262 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 260 def stream_specification data.stream_specification end |
#table_arn ⇒ String
The Amazon Resource Name (ARN) that uniquely identifies the table.
132 133 134 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 132 def table_arn data.table_arn end |
#table_size_bytes ⇒ Integer
The total size of the specified table, in bytes. DynamoDB updates this value approximately every six hours. Recent changes might not be reflected in this value.
118 119 120 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 118 def table_size_bytes data.table_size_bytes end |
#table_status ⇒ String
The current state of the table:
-
‘CREATING` - The table is being created.
-
‘UPDATING` - The table is being updated.
-
‘DELETING` - The table is being deleted.
-
‘ACTIVE` - The table is ready for use.
91 92 93 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 91 def table_status data.table_status end |
#update(options = {}) ⇒ Table
1639 1640 1641 1642 1643 1644 1645 1646 1647 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 1639 def update( = {}) = .merge(table_name: @name) resp = @client.update_table() Table.new( name: @name, data: resp.data.table_description, client: @client ) end |
#update_item(options = {}) ⇒ Types::UpdateItemOutput
1946 1947 1948 1949 1950 |
# File 'lib/aws-sdk-dynamodb/table.rb', line 1946 def update_item( = {}) = .merge(table_name: @name) resp = @client.update_item() resp.data end |