MCPcopy
hub / github.com/redis/redis-py / alias

Method alias

redis/commands/search/aggregation.py:34–56  ·  view source on GitHub ↗

Set the alias for this reducer. ### Parameters - **alias**: The value of the alias for this reducer. If this is the special value `aggregation.FIELDNAME` then this reducer will be aliased using the same name as the field upon which it operates.

(self, alias: str)

Source from the content-addressed store, hash-verified

32 self._alias: Optional[str] = None
33
34 def alias(self, alias: str) -> "Reducer":
35 """
36 Set the alias for this reducer.
37
38 ### Parameters
39
40 - **alias**: The value of the alias for this reducer. If this is the
41 special value `aggregation.FIELDNAME` then this reducer will be
42 aliased using the same name as the field upon which it operates.
43 Note that using `FIELDNAME` is only possible on reducers which
44 operate on a single field value.
45
46 This method returns the `Reducer` object making it suitable for
47 chaining.
48 """
49 if alias is FIELDNAME:
50 if not self._field:
51 raise ValueError("Cannot use FIELDNAME alias with no field")
52 else:
53 # Chop off initial '@'
54 alias = self._field[1:]
55 self._alias = alias
56 return self
57
58 @property
59 def args(self) -> Tuple[str, ...]:

Calls

no outgoing calls