odata_query.rewrite module

class odata_query.rewrite.AliasRewriter(field_aliases: Dict[str, str], lexer: Optional[ODataLexer] = None, parser: Optional[ODataParser] = None)[source]

Bases: NodeTransformer

A NodeTransformer that replaces aliases in the AST with their aliased identifiers or attributes.

Parameters:
  • field_aliases – A mapping of aliases to their full name. These can be identifiers, attributes, and even function calls in odata syntax.

  • lexer – Optional lexer instance to use. If not passed, will construct the default one.

  • parser – Optional parser instance to use. If not passed, will construct the default one.

class odata_query.rewrite.IdentifierStripper(strip: Identifier)[source]

Bases: NodeTransformer

A NodeTransformer that strips the given identifier off of attributes. E.g. author/name -> name.

Parameters:

strip – The identifier to strip off of all attributes in the AST