odata_query.rewrite module
- class odata_query.rewrite.AliasRewriter(field_aliases: Dict[str, str], lexer: Optional[odata_query.grammar.ODataLexer] = None, parser: Optional[odata_query.grammar.ODataParser] = None)[source]
Bases:
odata_query.visitor.NodeTransformerA
NodeTransformerthat 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: odata_query.ast.Identifier)[source]
Bases:
odata_query.visitor.NodeTransformerA
NodeTransformerthat 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