File: //usr/lib/python3/dist-packages/boto/dynamodb2/__pycache__/table.cpython-310.pyc
o
ckF[�� � @ s� d dl Z d dlmZ d dlmZmZmZmZmZm Z m
Z
mZ d dlm
Z
d dlmZ d dlmZmZ d dlmZmZmZmZmZ d dlmZ G d d
� d
e�ZG dd� de�ZdS )
� N)�
exceptions)�HashKey�RangeKey�AllIndex�
KeysOnlyIndex�IncludeIndex�GlobalAllIndex�GlobalKeysOnlyIndex�GlobalIncludeIndex)�Item)�DynamoDBConnection)� ResultSet�BatchGetResultSet)�NonBooleanDynamizer� Dynamizer�FILTER_OPERATORS�QUERY_OPERATORS�STRING)�JSONResponseErrorc @ s� e Zd ZdZdZeeeeed�ee e
ed�d�Z dLdd�Z
dd � Ze dMd
d��ZdNdd
�Zdd� Zdd� Zdd� Zdd� ZdOdd�Zdd� Zdd� Zdd� Zdd� Zd d!� ZdPd#d$�Zd%d&� Zd'd(� Zd)d*� ZdQd+d,�Z dNd-d.�Z!dNd/d0�Z"dOd1d2�Z#d3d4� Z$d5d6� Z%e&fd7d8�Z' " dRd9d:�Z( " dSd;d<�Z) dTd>d?�Z* " dUd@dA�Z+ dVdBdC�Z, dVdDdE�Z-dPdFdG�Z.dPdHdI�Z/dJdK� Z0dS )W�Tablea�
Interacts & models the behavior of a DynamoDB table.
The ``Table`` object represents a set (or rough categorization) of
records within DynamoDB. The important part is that all records within the
table, while largely-schema-free, share the same schema & are essentially
namespaced for use in your application. For example, you might have a
``users`` table or a ``forums`` table.
�d )�ALL� KEYS_ONLY�INCLUDE)�global_indexes�
local_indexesNc C sV || _ || _ddd�| _|| _|| _|| _| jdu rt� | _|dur%|| _t� | _dS )a
Sets up a new in-memory ``Table``.
This is useful if the table already exists within DynamoDB & you simply
want to use it for additional interactions. The only required parameter
is the ``table_name``. However, under the hood, the object will call
``describe_table`` to determine the schema/indexes/throughput. You
can avoid this extra call by passing in ``schema`` & ``indexes``.
**IMPORTANT** - If you're creating a new ``Table`` for the first time,
you should use the ``Table.create`` method instead, as it will
persist the table structure to DynamoDB.
Requires a ``table_name`` parameter, which should be a simple string
of the name of the table.
Optionally accepts a ``schema`` parameter, which should be a list of
``BaseSchemaField`` subclasses representing the desired schema.
Optionally accepts a ``throughput`` parameter, which should be a
dictionary. If provided, it should specify a ``read`` & ``write`` key,
both of which should have an integer value associated with them.
Optionally accepts a ``indexes`` parameter, which should be a list of
``BaseIndexField`` subclasses representing the desired indexes.
Optionally accepts a ``global_indexes`` parameter, which should be a
list of ``GlobalBaseIndexField`` subclasses representing the desired
indexes.
Optionally accepts a ``connection`` parameter, which should be a
``DynamoDBConnection`` instance (or subclass). This is primarily useful
for specifying alternate connection parameters.
Example::
# The simple, it-already-exists case.
>>> conn = Table('users')
# The full, minimum-extra-calls case.
>>> from boto import dynamodb2
>>> users = Table('users', schema=[
... HashKey('username'),
... RangeKey('date_joined', data_type=NUMBER)
... ], throughput={
... 'read':20,
... 'write': 10,
... }, indexes=[
... KeysOnlyIndex('MostRecentlyJoined', parts=[
... HashKey('username')
... RangeKey('date_joined')
... ]),
... ], global_indexes=[
... GlobalAllIndex('UsersByZipcode', parts=[
... HashKey('zipcode'),
... RangeKey('username'),
... ],
... throughput={
... 'read':10,
... 'write':10,
... }),
... ], connection=dynamodb2.connect_to_region('us-west-2',
... aws_access_key_id='key',
... aws_secret_access_key='key',
... ))
� )�read�writeN) �
table_name�
connection�
throughput�schema�indexesr r r �
_dynamizer)�selfr r"