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()

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, refresh=False, metrics=False)[source]

Get the TableMeta for a table

describe_all()[source]

Describe all tables in the connected region

execute(commands, pformat=False)[source]

Parse and run a DQL string

Parameters:

commands : str

The DQL command string

pformat : bool

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

get_capacity(tablename, index_name=None)[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, pformat=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.iter_insert_items(tree)[source]

Iterate over the items to insert from an INSERT statement

dql.engine.plural(value, append='s')[source]

Helper function for pluralizing text

dql.engine.pretty_format(statement, result)[source]

Format the return value of a query for humans