pandagg.node.query.abstract module

class pandagg.node.query.abstract.AbstractSingleFieldQueryClause(field: str, _name: Optional[str] = None, **body)[source]

Bases: pandagg.node.query.abstract.LeafQueryClause

class pandagg.node.query.abstract.FlatFieldQueryClause(field: str, _name: Optional[str] = None, **body)[source]

Bases: pandagg.node.query.abstract.AbstractSingleFieldQueryClause

Query clause applied on one single field. Example:

Exists: {“exists”: {“field”: “user”}} -> field = “user” -> body = {“field”: “user”} >>> from pandagg.query import Exists >>> q = Exists(field=”user”)

DistanceFeature: {“distance_feature”: {“field”: “production_date”, “pivot”: “7d”, “origin”: “now”}} -> field = “production_date” -> body = {“field”: “production_date”, “pivot”: “7d”, “origin”: “now”} >>> from pandagg.query import DistanceFeature >>> q = DistanceFeature(field=”production_date”, pivot=”7d”, origin=”now”)

class pandagg.node.query.abstract.KeyFieldQueryClause(field: Optional[str] = None, _name: Optional[str] = None, _expand__to_dot: bool = True, **params)[source]

Bases: pandagg.node.query.abstract.AbstractSingleFieldQueryClause

Clause with field used as key in clause body:

Term: {“term”: {“user”: {“value”: “Kimchy”, “boost”: 1}}} -> field = “user” -> body = {“user”: {“value”: “Kimchy”, “boost”: 1}} >>> from pandagg.query import Term >>> q1 = Term(user={“value”: “Kimchy”, “boost”: 1}}) >>> q2 = Term(field=”user”, value=”Kimchy”, boost=1}})

Can accept a “_implicit_param” attribute specifying which is the equivalent key when inner body isn’t a dict but a raw value. For Term: _implicit_param = “value” >>> q = Term(user=”Kimchy”) {“term”: {“user”: {“value”: “Kimchy”}}} -> field = “user” -> body = {“term”: {“user”: {“value”: “Kimchy”}}}

line_repr(depth: int, **kwargs) → Tuple[str, str][source]

Control how node is displayed in tree representation. First returned string is how node is represented on left, second string is how node is represented on right.

MyTree ├── one OneEnd │ └── two twoEnd └── three threeEnd

class pandagg.node.query.abstract.LeafQueryClause(_name: Optional[str] = None, **body)[source]

Bases: pandagg.node.query.abstract.QueryClause

class pandagg.node.query.abstract.MultiFieldsQueryClause(fields: List[str], _name: Optional[str] = None, **body)[source]

Bases: pandagg.node.query.abstract.LeafQueryClause

line_repr(depth: int, **kwargs) → Tuple[str, str][source]

Control how node is displayed in tree representation. First returned string is how node is represented on left, second string is how node is represented on right.

MyTree ├── one OneEnd │ └── two twoEnd └── three threeEnd

class pandagg.node.query.abstract.ParentParameterClause[source]

Bases: pandagg.node.query.abstract.QueryClause

line_repr(depth: int, **kwargs) → Tuple[str, str][source]

Control how node is displayed in tree representation. First returned string is how node is represented on left, second string is how node is represented on right.

MyTree ├── one OneEnd │ └── two twoEnd └── three threeEnd

pandagg.node.query.abstract.Q(type_or_query: Union[str, Dict[str, Dict[str, Any]], pandagg.node.query.abstract.QueryClause, None] = None, **body) → pandagg.node.query.abstract.QueryClause[source]

Accept multiple syntaxes, return a QueryClause node.

Parameters:
  • type_or_query
  • body
Returns:

QueryClause

class pandagg.node.query.abstract.QueryClause(_name: Optional[str] = None, accept_children: bool = True, keyed: bool = True, _children: Any = None, **body)[source]

Bases: pandagg.node._node.Node

line_repr(depth: int, **kwargs) → Tuple[str, str][source]

Control how node is displayed in tree representation. First returned string is how node is represented on left, second string is how node is represented on right.

MyTree ├── one OneEnd │ └── two twoEnd └── three threeEnd

name
to_dict() → Dict[str, Any][source]