dql.expressions.visitor module

Visitor classes for traversing expressions

class dql.expressions.visitor.DummyVisitor(reserved_words=None)[source]

Bases: dql.expressions.visitor.Visitor

No-op visitor for testing

get_field(self, field)[source]

No-op

get_value(self, value)[source]

No-op

class dql.expressions.visitor.Visitor(reserved_words=None)[source]

Bases: object

Visitor that replaces field names and values with encoded versions

Parameters:
reserved_words : set, optional

Set of (uppercase) words that are reserved by DynamoDB. These are used when encoding field names. If None, will default to encoding all fields.

attribute_names[source]

Dict of encoded field names to original names

expression_values[source]

Dict of encoded variable names to the variables

get_field(self, field)[source]

Get the safe representation of a field name

For example, since ‘order’ is reserved, it would encode it as ‘#f1’

get_value(self, value)[source]

Replace variable names with placeholders (e.g. ‘:v1’)