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(self, *args, **kwargs)[source]

Proxy to DynamoDBConnection.connect.

connection[source]

Get the dynamo connection

describe(self, tablename, refresh=False, metrics=False, require=False)[source]

Get the TableMeta for a table

describe_all(self, refresh=True)[source]

Describe all tables in the connected region

execute(self, 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(self, tablename, index_name=None)[source]

Get the consumed read/write capacity

region[source]

Get the connected dynamo region or host

exception dql.engine.ExplainSignal[source]

Bases: exceptions.Exception

Thrown to stop a query when we’re doing an EXPLAIN

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

Bases: dql.engine.Engine

A DQL execution engine that can handle query fragments

execute(self, 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(self, exc)[source]

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

reset(self)[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