dql.engine module

Execution engine

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

Bases: object

DQL execution engine


connection : DynamoDBConnection, optional

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


Lazy create a connection to cloudwatch

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

Proxy to DynamoDBConnection.connect.


Get the dynamo connection

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

Get the TableMeta for a table


Describe all tables in the connected region

execute(commands, pformat=False)[source]

Parse and run a DQL string


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


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.


True if there is a partial query stored


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


Clear any query fragments from the engine

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

Construct KeyConditionExpression and FilterExpression


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