Projection

class Projection(*args, **kwds)[source]

Bases: Generic[ProjectionType]

Marker base class for all projections.

Projections allow the client to transform (strip down) each query result object in order to avoid redundant network traffic.

single_attribute(attribute_path: str) Projection[ProjectionType][source]

Creates a projection that extracts the value of the given attribute path.

Parameters

attribute_path – Path to extract the attribute from.

Returns

A projection that extracts the value of the given attribute path.

multi_attribute(*attribute_paths: str) Projection[List[Any]][source]

Creates a projection that extracts the values of one or more attribute paths.

Parameters

*attribute_paths – Paths to extract the attributes from.

Returns

A projection that extracts the values of the given attribute paths.

identity() Projection[MapEntry[KeyType, ValueType]][source]

Creates a projection that does no transformation.

Returns

A projection that does no transformation.