Repository navigation
feat: add TS.QUERYLABELS support to the timeseries command surface - #4197
Merged
Merged
Conversation
vladvildanov
requested changes
Jul 20, 2026
petyaslavova
force-pushed
the
ps_ts_querylabels_support
branch
from
July 20, 2026 13:19
7155c11 to
05d70b9
Compare
vladvildanov
approved these changes
Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change summary
This pull request adds support for the
TS.QUERYLABELSRedisTimeSeries commandas a new
querylabels(label=None, filters=None)method on the sharedTimeSeriesCommandsclass. Omittinglabelissues theLABELSform (union oflabel names across matching series); passing
labelissues theVALUESform(deduplicated values for that label).
filters=Nonequeries all indexed series,while an explicitly empty collection raises
DataError. Filters andlabelarepassed byte-exact, so server-side filter errors surface unchanged as
ResponseError. Aparse_query_labelscallback normalizes the reply to aPython
list(RESP2 array / RESP3 set) and maps a missing reply to[].The change is purely additive and, because
TimeSeriesCommandsis shared, thesingle method plus typed
@overloads serve bothRedisandredis.asyncio.Rediswith aligned sync/async signatures β nobackward-compatibility or wire-protocol risk.
Test coverage
New tests in tests/test_timeseries.py and
tests/test_asyncio/test_timeseries.py,
kept in lockstep, cover the
LABELSandVALUESforms (with and withoutfilters), byte-exact values that aren't coerced to numbers, empty results as a
normal success, the
DataErrorfor emptyfilters, and server-side parseerrors surfacing as
ResponseError.Note
Low Risk
Additive TimeSeries API with local validation only; no changes to existing commands or wire behavior for current callers.
Overview
Adds
TS.QUERYLABELSto the RedisTimeSeries client asquerylabels(label=None, filters=None)on sharedTimeSeriesCommands, so sync and asyncts()callers get the same API.labelomitted sends theLABELSform (union of label names on matching series).labelset sendsVALUES(deduplicated values for that label).filters=Nonequeries all indexed series; an emptyfilterscollection raisesDataErrorlocally. Filters use the same expressions asqueryindexand are passed through verbatim.parse_query_labelsnormalizes RESP2 arrays and RESP3 sets to a Pythonset. The command is wired viaQUERYLABELS_CMDin the timeseries module callbacks.Contributor docs now recommend
Iterable[str]for filter arguments that are only iterated. Integration tests (sync + async, Redis β₯ 8.9.0) cover LABELS/VALUES modes, iterables, empty results, client validation, and serverResponseErroron bad filters.Reviewed by Cursor Bugbot for commit 1d50805. Bugbot is set up for automated code reviews on this repo. Configure here.