mate_query.cpg.models.core.relationships module¶
This module contains implementation details; it is not part of the MATE API.
Helpers for deriving documentation and relationships from the MATE JSON schemata.
- class mate_query.cpg.models.core.relationships.Direction(value)¶
Bases:
enum.EnumAn enumeration.
- IN = 'in'¶
- OUT = 'out'¶
- SYMMETRIC = 'symmetric'¶
- class mate_query.cpg.models.core.relationships.EnumComparator(expression)¶
Bases:
sqlalchemy.ext.hybrid.ComparatorA specialized SQLAlchemy Comparator for
enum.Enum.- operate(op: Any, other: Any, **_kwargs: Any) Any¶
Operate on an argument.
This is the lowest level of operation, raises
NotImplementedErrorby default.Overriding this on a subclass can allow common behavior to be applied to all operations. For example, overriding
ColumnOperatorsto applyfunc.lower()to the left and right side:class MyComparator(ColumnOperators): def operate(self, op, other): return op(func.lower(self), func.lower(other))
- prop¶
- property¶
- mate_query.cpg.models.core.relationships.add_properties_to_node_class(cls: Type[Node]) Any¶
Add documentation and hybrid properties from the JSON schema to a node class.
- Parameters
cls (Type[Node]) –
- Return type
Any
- mate_query.cpg.models.core.relationships.make_edge_relationship(cpg: CPG, edge_kind: EdgeKind, this: Type[Node], other: Type[Node], direction: Optional[Direction] = None, back_populates: Optional[str] = None, backref: Optional[str] = None) RelationshipProperty¶
Generate a SQLAlchemy relationship given an edge kind.