summaryrefslogtreecommitdiff
path: root/redis/commands/timeseries/commands.py
diff options
context:
space:
mode:
authorChayim <chayim@users.noreply.github.com>2021-11-30 17:22:19 +0200
committerGitHub <noreply@github.com>2021-11-30 17:22:19 +0200
commitd5247091464f91f06d8ca71bb785b448a0d4cc3e (patch)
tree88b16f17281596ae6676525186b668f2635e3346 /redis/commands/timeseries/commands.py
parent3da0b131ac52b82a1e4a90871a81a41a0ff63a9f (diff)
downloadredis-py-d5247091464f91f06d8ca71bb785b448a0d4cc3e.tar.gz
Link Documents for all module commands (#1711)
Diffstat (limited to 'redis/commands/timeseries/commands.py')
-rw-r--r--redis/commands/timeseries/commands.py62
1 files changed, 35 insertions, 27 deletions
diff --git a/redis/commands/timeseries/commands.py b/redis/commands/timeseries/commands.py
index fcb535b..460ba76 100644
--- a/redis/commands/timeseries/commands.py
+++ b/redis/commands/timeseries/commands.py
@@ -26,8 +26,6 @@ class TimeSeriesCommands:
def create(self, key, **kwargs):
"""
Create a new time-series.
- For more information see
- `TS.CREATE <https://oss.redis.com/redistimeseries/master/commands/#tscreate>`_.
Args:
@@ -60,6 +58,8 @@ class TimeSeriesCommands:
- 'min': only override if the value is lower than the existing value.
- 'max': only override if the value is higher than the existing value.
When this is not set, the server-wide default will be used.
+
+ For more information: https://oss.redis.com/redistimeseries/commands/#tscreate
""" # noqa
retention_msecs = kwargs.get("retention_msecs", None)
uncompressed = kwargs.get("uncompressed", False)
@@ -79,9 +79,10 @@ class TimeSeriesCommands:
"""
Update the retention, labels of an existing key.
For more information see
- `TS.ALTER <https://oss.redis.com/redistimeseries/master/commands/#tsalter>`_.
The parameters are the same as TS.CREATE.
+
+ For more information: https://oss.redis.com/redistimeseries/commands/#tsalter
""" # noqa
retention_msecs = kwargs.get("retention_msecs", None)
labels = kwargs.get("labels", {})
@@ -97,7 +98,6 @@ class TimeSeriesCommands:
"""
Append (or create and append) a new sample to the series.
For more information see
- `TS.ADD <https://oss.redis.com/redistimeseries/master/commands/#tsadd>`_.
Args:
@@ -129,6 +129,8 @@ class TimeSeriesCommands:
- 'min': only override if the value is lower than the existing value.
- 'max': only override if the value is higher than the existing value.
When this is not set, the server-wide default will be used.
+
+ For more information: https://oss.redis.com/redistimeseries/master/commands/#tsadd
""" # noqa
retention_msecs = kwargs.get("retention_msecs", None)
uncompressed = kwargs.get("uncompressed", False)
@@ -150,8 +152,8 @@ class TimeSeriesCommands:
`key` with `timestamp`.
Expects a list of `tuples` as (`key`,`timestamp`, `value`).
Return value is an array with timestamps of insertions.
- For more information see
- `TS.MADD <https://oss.redis.com/redistimeseries/master/commands/#tsmadd>`_.
+
+ For more information: https://oss.redis.com/redistimeseries/master/commands/#tsmadd
""" # noqa
params = []
for ktv in ktv_tuples:
@@ -166,8 +168,6 @@ class TimeSeriesCommands:
sample's of a series.
This command can be used as a counter or gauge that automatically gets
history as a time series.
- For more information see
- `TS.INCRBY <https://oss.redis.com/redistimeseries/master/commands/#tsincrbytsdecrby>`_.
Args:
@@ -189,6 +189,8 @@ class TimeSeriesCommands:
chunk_size:
Each time-series uses chunks of memory of fixed size for time series samples.
You can alter the default TSDB chunk size by passing the chunk_size argument (in Bytes).
+
+ For more information: https://oss.redis.com/redistimeseries/master/commands/#tsincrbytsdecrby
""" # noqa
timestamp = kwargs.get("timestamp", None)
retention_msecs = kwargs.get("retention_msecs", None)
@@ -210,8 +212,6 @@ class TimeSeriesCommands:
latest sample's of a series.
This command can be used as a counter or gauge that
automatically gets history as a time series.
- For more information see
- `TS.DECRBY <https://oss.redis.com/redistimeseries/master/commands/#tsincrbytsdecrby>`_.
Args:
@@ -237,6 +237,8 @@ class TimeSeriesCommands:
chunk_size:
Each time-series uses chunks of memory of fixed size for time series samples.
You can alter the default TSDB chunk size by passing the chunk_size argument (in Bytes).
+
+ For more information: https://oss.redis.com/redistimeseries/master/commands/#tsincrbytsdecrby
""" # noqa
timestamp = kwargs.get("timestamp", None)
retention_msecs = kwargs.get("retention_msecs", None)
@@ -260,7 +262,6 @@ class TimeSeriesCommands:
and end data points will also be deleted.
Return the count for deleted items.
For more information see
- `TS.DEL <https://oss.redis.com/redistimeseries/master/commands/#tsdel>`_.
Args:
@@ -270,6 +271,8 @@ class TimeSeriesCommands:
Start timestamp for the range deletion.
to_time:
End timestamp for the range deletion.
+
+ For more information: https://oss.redis.com/redistimeseries/master/commands/#tsdel
""" # noqa
return self.execute_command(DEL_CMD, key, from_time, to_time)
@@ -285,8 +288,8 @@ class TimeSeriesCommands:
Aggregating for `bucket_size_msec` where an `aggregation_type` can be
[`avg`, `sum`, `min`, `max`, `range`, `count`, `first`, `last`,
`std.p`, `std.s`, `var.p`, `var.s`]
- For more information see
- `TS.CREATERULE <https://oss.redis.com/redistimeseries/master/commands/#tscreaterule>`_.
+
+ For more information: https://oss.redis.com/redistimeseries/master/commands/#tscreaterule
""" # noqa
params = [source_key, dest_key]
self._appendAggregation(params, aggregation_type, bucket_size_msec)
@@ -297,7 +300,8 @@ class TimeSeriesCommands:
"""
Delete a compaction rule.
For more information see
- `TS.DELETERULE <https://oss.redis.com/redistimeseries/master/commands/#tsdeleterule>`_.
+
+ For more information: https://oss.redis.com/redistimeseries/master/commands/#tsdeleterule
""" # noqa
return self.execute_command(DELETERULE_CMD, source_key, dest_key)
@@ -343,8 +347,6 @@ class TimeSeriesCommands:
):
"""
Query a range in forward direction for a specific time-serie.
- For more information see
- `TS.RANGE <https://oss.redis.com/redistimeseries/master/commands/#tsrangetsrevrange>`_.
Args:
@@ -374,6 +376,8 @@ class TimeSeriesCommands:
by_min_value).
align:
Timestamp for alignment control for aggregation.
+
+ For more information: https://oss.redis.com/redistimeseries/master/commands/#tsrangetsrevrange
""" # noqa
params = self.__range_params(
key,
@@ -404,8 +408,6 @@ class TimeSeriesCommands:
):
"""
Query a range in reverse direction for a specific time-series.
- For more information see
- `TS.REVRANGE <https://oss.redis.com/redistimeseries/master/commands/#tsrangetsrevrange>`_.
**Note**: This command is only available since RedisTimeSeries >= v1.4
@@ -432,6 +434,8 @@ class TimeSeriesCommands:
Filter result by maximum value (must mention also filter_by_min_value).
align:
Timestamp for alignment control for aggregation.
+
+ For more information: https://oss.redis.com/redistimeseries/master/commands/#tsrangetsrevrange
""" # noqa
params = self.__range_params(
key,
@@ -500,8 +504,6 @@ class TimeSeriesCommands:
):
"""
Query a range across multiple time-series by filters in forward direction.
- For more information see
- `TS.MRANGE <https://oss.redis.com/redistimeseries/master/commands/#tsmrangetsmrevrange>`_.
Args:
@@ -544,6 +546,8 @@ class TimeSeriesCommands:
pair labels of a series.
align:
Timestamp for alignment control for aggregation.
+
+ For more information: https://oss.redis.com/redistimeseries/master/commands/#tsmrangetsmrevrange
""" # noqa
params = self.__mrange_params(
aggregation_type,
@@ -583,8 +587,6 @@ class TimeSeriesCommands:
):
"""
Query a range across multiple time-series by filters in reverse direction.
- For more information see
- `TS.MREVRANGE <https://oss.redis.com/redistimeseries/master/commands/#tsmrangetsmrevrange>`_.
Args:
@@ -629,6 +631,8 @@ class TimeSeriesCommands:
labels of a series.
align:
Timestamp for alignment control for aggregation.
+
+ For more information: https://oss.redis.com/redistimeseries/master/commands/#tsmrangetsmrevrange
""" # noqa
params = self.__mrange_params(
aggregation_type,
@@ -652,14 +656,16 @@ class TimeSeriesCommands:
def get(self, key):
""" # noqa
Get the last sample of `key`.
- For more information see `TS.GET <https://oss.redis.com/redistimeseries/master/commands/#tsget>`_.
+
+ For more information: https://oss.redis.com/redistimeseries/master/commands/#tsget
""" # noqa
return self.execute_command(GET_CMD, key)
def mget(self, filters, with_labels=False):
""" # noqa
Get the last samples matching the specific `filter`.
- For more information see `TS.MGET <https://oss.redis.com/redistimeseries/master/commands/#tsmget>`_.
+
+ For more information: https://oss.redis.com/redistimeseries/master/commands/#tsmget
""" # noqa
params = []
self._appendWithLabels(params, with_labels)
@@ -670,15 +676,17 @@ class TimeSeriesCommands:
def info(self, key):
""" # noqa
Get information of `key`.
- For more information see `TS.INFO <https://oss.redis.com/redistimeseries/master/commands/#tsinfo>`_.
+
+ For more information: https://oss.redis.com/redistimeseries/master/commands/#tsinfo
""" # noqa
return self.execute_command(INFO_CMD, key)
def queryindex(self, filters):
""" # noqa
Get all the keys matching the `filter` list.
- For more information see `TS.QUERYINDEX <https://oss.redis.com/redistimeseries/master/commands/#tsqueryindex>`_.
- """ # noqa
+
+ For more information: https://oss.redis.com/redistimeseries/master/commands/#tsqueryindex
+ """ # noq
return self.execute_command(QUERYINDEX_CMD, *filters)
@staticmethod