dql.engine module

Execution engine

class dql.engine.Engine(connection=None)[source]

Bases: object

DQL execution engine

Parameters:
connection : DynamoDBConnection, optional

If not present, you will need to call Engine.connect()

Attributes:
caution_callback : callable, optional

Called to prompt user when a potentially dangerous action is about to occur.

cloudwatch_connection[source]

Lazy create a connection to cloudwatch

connect(*args, **kwargs)[source]

Proxy to DynamoDBConnection.connect.

connection[source]

Get the dynamo connection

describe(tablename: str, refresh: bool = False, metrics: bool = False, require: bool = False) → Optional[dql.models.TableMeta][source]

Get the TableMeta for a table

describe_all(refresh=True)[source]

Describe all tables in the connected region

execute(commands, pretty_format=False)[source]

Parse and run a DQL string

Parameters:
commands : str

The DQL command string

pretty_format : bool

Pretty-format the return value. (e.g. 4 -> ‘Updated 4 items’)

get_capacity(tablename: str, index_name: Optional[str] = None) → Tuple[float, float][source]

Get the consumed read/write capacity

region[source]

Get the connected dynamo region or host

class dql.engine.FragmentEngine(connection=None)[source]

Bases: dql.engine.Engine

A DQL execution engine that can handle query fragments

execute(fragment, pretty_format=True)[source]

Run or aggregate a query fragment

Concat the fragment to any stored fragments. If they form a complete query, run it and return the result. If not, store them and return None.

partial[source]

True if there is a partial query stored

pformat_exc(exc)[source]

Format an exception message for the last query’s parse error

reset()[source]

Clear any query fragments from the engine

dql.engine.add_query_kwargs(kwargs, visitor, constraints, index)[source]

Construct KeyConditionExpression and FilterExpression

dql.engine.default(value)[source]

Default encoder for JSON

dql.engine.iter_insert_items(tree)[source]

Iterate over the items to insert from an INSERT statement