valkey-glide 1.2.0rc14__cp311-cp311-macosx_11_0_arm64.whl → 2.2.3__cp311-cp311-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- glide/__init__.py +169 -104
- glide/async_commands/cluster_commands.py +367 -172
- glide/async_commands/core.py +1808 -1026
- glide/async_commands/{server_modules/ft.py → ft.py} +91 -21
- glide/async_commands/{server_modules/glide_json.py → glide_json.py} +161 -146
- glide/async_commands/standalone_commands.py +204 -136
- glide/glide.cpython-311-darwin.so +0 -0
- glide/glide.pyi +26 -1
- glide/glide_client.py +355 -136
- glide/logger.py +34 -22
- glide/opentelemetry.py +185 -0
- glide_shared/__init__.py +330 -0
- glide_shared/commands/__init__.py +0 -0
- glide/async_commands/transaction.py → glide_shared/commands/batch.py +1845 -1059
- glide_shared/commands/batch_options.py +261 -0
- {glide/async_commands → glide_shared/commands}/bitmap.py +96 -86
- {glide/async_commands → glide_shared/commands}/command_args.py +7 -6
- glide_shared/commands/core_options.py +407 -0
- {glide/async_commands → glide_shared/commands}/server_modules/ft_options/ft_aggregate_options.py +18 -11
- {glide/async_commands → glide_shared/commands}/server_modules/ft_options/ft_create_options.py +27 -13
- {glide/async_commands → glide_shared/commands}/server_modules/ft_options/ft_profile_options.py +16 -11
- {glide/async_commands → glide_shared/commands}/server_modules/ft_options/ft_search_options.py +17 -9
- glide_shared/commands/server_modules/json_batch.py +820 -0
- glide_shared/commands/server_modules/json_options.py +93 -0
- {glide/async_commands → glide_shared/commands}/sorted_set.py +42 -32
- {glide/async_commands → glide_shared/commands}/stream.py +95 -88
- glide_shared/config.py +975 -0
- {glide → glide_shared}/constants.py +11 -7
- {glide → glide_shared}/exceptions.py +27 -1
- glide_shared/protobuf/command_request_pb2.py +56 -0
- glide_shared/protobuf/connection_request_pb2.py +56 -0
- {glide → glide_shared}/protobuf/response_pb2.py +6 -6
- {glide → glide_shared}/protobuf_codec.py +7 -6
- glide_shared/routes.py +161 -0
- valkey_glide-2.2.3.dist-info/METADATA +211 -0
- valkey_glide-2.2.3.dist-info/RECORD +40 -0
- {valkey_glide-1.2.0rc14.dist-info → valkey_glide-2.2.3.dist-info}/WHEEL +1 -1
- glide/config.py +0 -521
- glide/protobuf/command_request_pb2.py +0 -54
- glide/protobuf/command_request_pb2.pyi +0 -1161
- glide/protobuf/connection_request_pb2.py +0 -52
- glide/protobuf/connection_request_pb2.pyi +0 -287
- glide/protobuf/response_pb2.pyi +0 -101
- glide/routes.py +0 -114
- valkey_glide-1.2.0rc14.dist-info/METADATA +0 -122
- valkey_glide-1.2.0rc14.dist-info/RECORD +0 -36
- {glide/async_commands → glide_shared/commands}/server_modules/ft_options/ft_constants.py +0 -0
|
@@ -5,24 +5,24 @@ module for `vector search` commands.
|
|
|
5
5
|
|
|
6
6
|
from typing import List, Mapping, Optional, cast
|
|
7
7
|
|
|
8
|
-
from
|
|
8
|
+
from glide_shared.commands.server_modules.ft_options.ft_aggregate_options import (
|
|
9
9
|
FtAggregateOptions,
|
|
10
10
|
)
|
|
11
|
-
from
|
|
11
|
+
from glide_shared.commands.server_modules.ft_options.ft_constants import (
|
|
12
12
|
CommandNames,
|
|
13
13
|
FtCreateKeywords,
|
|
14
14
|
)
|
|
15
|
-
from
|
|
15
|
+
from glide_shared.commands.server_modules.ft_options.ft_create_options import (
|
|
16
16
|
Field,
|
|
17
17
|
FtCreateOptions,
|
|
18
18
|
)
|
|
19
|
-
from
|
|
19
|
+
from glide_shared.commands.server_modules.ft_options.ft_profile_options import (
|
|
20
20
|
FtProfileOptions,
|
|
21
21
|
)
|
|
22
|
-
from
|
|
22
|
+
from glide_shared.commands.server_modules.ft_options.ft_search_options import (
|
|
23
23
|
FtSearchOptions,
|
|
24
24
|
)
|
|
25
|
-
from
|
|
25
|
+
from glide_shared.constants import (
|
|
26
26
|
TOK,
|
|
27
27
|
FtAggregateResponse,
|
|
28
28
|
FtInfoResponse,
|
|
@@ -30,7 +30,8 @@ from glide.constants import (
|
|
|
30
30
|
FtSearchResponse,
|
|
31
31
|
TEncodable,
|
|
32
32
|
)
|
|
33
|
-
|
|
33
|
+
|
|
34
|
+
from ..glide_client import TGlideClient
|
|
34
35
|
|
|
35
36
|
|
|
36
37
|
async def create(
|
|
@@ -115,7 +116,8 @@ async def search(
|
|
|
115
116
|
options: Optional[FtSearchOptions],
|
|
116
117
|
) -> FtSearchResponse:
|
|
117
118
|
"""
|
|
118
|
-
Uses the provided query expression to locate keys within an index. Once located, the count and/or the content of indexed
|
|
119
|
+
Uses the provided query expression to locate keys within an index. Once located, the count and/or the content of indexed
|
|
120
|
+
fields within those keys can be returned.
|
|
119
121
|
|
|
120
122
|
Args:
|
|
121
123
|
client (TGlideClient): The client to execute the command.
|
|
@@ -124,8 +126,11 @@ async def search(
|
|
|
124
126
|
options (Optional[FtSearchOptions]): The search options.
|
|
125
127
|
|
|
126
128
|
Returns:
|
|
127
|
-
FtSearchResponse: A two element array, where first element is count of documents in result set, and the second
|
|
128
|
-
|
|
129
|
+
FtSearchResponse: A two element array, where first element is count of documents in result set, and the second
|
|
130
|
+
element, which has the format Mapping[TEncodable, Mapping[TEncodable, TEncodable]] is a mapping between document
|
|
131
|
+
names and map of their attributes.
|
|
132
|
+
If count(option in `FtSearchOptions`) is set to true or limit(option in `FtSearchOptions`) is set to
|
|
133
|
+
FtSearchLimit(0, 0), the command returns array with only one element - the count of the documents.
|
|
129
134
|
|
|
130
135
|
Examples:
|
|
131
136
|
For the following example to work the following must already exist:
|
|
@@ -133,8 +138,20 @@ async def search(
|
|
|
133
138
|
- A key named {json:}1 with value {"a":1, "b":2}
|
|
134
139
|
|
|
135
140
|
>>> from glide import ft
|
|
136
|
-
>>> await ft.search(
|
|
137
|
-
|
|
141
|
+
>>> await ft.search(
|
|
142
|
+
... glide_client,
|
|
143
|
+
... "idx",
|
|
144
|
+
... "*",
|
|
145
|
+
... options=FtSeachOptions(
|
|
146
|
+
... return_fields=[
|
|
147
|
+
... ReturnField(field_identifier="first"),
|
|
148
|
+
... ReturnField(field_identifier="second")
|
|
149
|
+
... ]
|
|
150
|
+
... )
|
|
151
|
+
... )
|
|
152
|
+
[1, { b'json:1': { b'first': b'42', b'second': b'33' } }]
|
|
153
|
+
# The first element, 1 is the number of keys returned in the search result. The second element is a map of
|
|
154
|
+
# data queried per key.
|
|
138
155
|
"""
|
|
139
156
|
args: List[TEncodable] = [CommandNames.FT_SEARCH, index_name, query]
|
|
140
157
|
if options:
|
|
@@ -220,7 +237,8 @@ async def info(client: TGlideClient, index_name: TEncodable) -> FtInfoResponse:
|
|
|
220
237
|
FtInfoResponse: Nested maps with info about the index. See example for more details.
|
|
221
238
|
|
|
222
239
|
Examples:
|
|
223
|
-
An index with name 'myIndex', 1 text field and 1 vector field is already created for gettting the output of this
|
|
240
|
+
An index with name 'myIndex', 1 text field and 1 vector field is already created for gettting the output of this
|
|
241
|
+
example.
|
|
224
242
|
>>> from glide import ft
|
|
225
243
|
>>> await ft.info(glide_client, "myIndex")
|
|
226
244
|
[
|
|
@@ -236,7 +254,26 @@ async def info(client: TGlideClient, index_name: TEncodable) -> FtInfoResponse:
|
|
|
236
254
|
b'type', b'VECTOR',
|
|
237
255
|
b'option', b'',
|
|
238
256
|
b'vector_params', [
|
|
239
|
-
b'algorithm',
|
|
257
|
+
b'algorithm',
|
|
258
|
+
b'HNSW',
|
|
259
|
+
b'data_type',
|
|
260
|
+
b'FLOAT32',
|
|
261
|
+
b'dimension',
|
|
262
|
+
2,
|
|
263
|
+
b'distance_metric',
|
|
264
|
+
b'L2',
|
|
265
|
+
b'initial_capacity',
|
|
266
|
+
1000,
|
|
267
|
+
b'current_capacity',
|
|
268
|
+
1000,
|
|
269
|
+
b'maximum_edges',
|
|
270
|
+
16,
|
|
271
|
+
b'ef_construction',
|
|
272
|
+
200,
|
|
273
|
+
b'ef_runtime',
|
|
274
|
+
10,
|
|
275
|
+
b'epsilon',
|
|
276
|
+
b'0.01'
|
|
240
277
|
]
|
|
241
278
|
],
|
|
242
279
|
[
|
|
@@ -313,7 +350,8 @@ async def aggregate(
|
|
|
313
350
|
options: Optional[FtAggregateOptions],
|
|
314
351
|
) -> FtAggregateResponse:
|
|
315
352
|
"""
|
|
316
|
-
A superset of the FT.SEARCH command, it allows substantial additional processing of the keys selected by the query
|
|
353
|
+
A superset of the FT.SEARCH command, it allows substantial additional processing of the keys selected by the query
|
|
354
|
+
expression.
|
|
317
355
|
|
|
318
356
|
Args:
|
|
319
357
|
client (TGlideClient): The client to execute the command.
|
|
@@ -322,12 +360,34 @@ async def aggregate(
|
|
|
322
360
|
options (Optional[FtAggregateOptions]): The optional arguments for the command.
|
|
323
361
|
|
|
324
362
|
Returns:
|
|
325
|
-
FtAggregateResponse: An array containing a mapping of field name and associated value as returned after the last stage
|
|
363
|
+
FtAggregateResponse: An array containing a mapping of field name and associated value as returned after the last stage
|
|
364
|
+
of the command.
|
|
326
365
|
|
|
327
366
|
Examples:
|
|
328
367
|
>>> from glide import ft
|
|
329
|
-
>>> await ft.aggregate(
|
|
330
|
-
|
|
368
|
+
>>> await ft.aggregate(
|
|
369
|
+
... glide_client,
|
|
370
|
+
... "myIndex",
|
|
371
|
+
... "*",
|
|
372
|
+
... FtAggregateOptions(
|
|
373
|
+
... loadFields=["__key"],
|
|
374
|
+
... clauses=[GroupBy(["@condition"], [Reducer("COUNT", [], "bicycles")])]
|
|
375
|
+
... )
|
|
376
|
+
... )
|
|
377
|
+
[
|
|
378
|
+
{
|
|
379
|
+
b'condition': b'refurbished',
|
|
380
|
+
b'bicycles': b'1'
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
b'condition': b'new',
|
|
384
|
+
b'bicycles': b'5'
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
b'condition': b'used',
|
|
388
|
+
b'bicycles': b'4'
|
|
389
|
+
}
|
|
390
|
+
]
|
|
331
391
|
"""
|
|
332
392
|
args: List[TEncodable] = [CommandNames.FT_AGGREGATE, index_name, query]
|
|
333
393
|
if options:
|
|
@@ -347,11 +407,21 @@ async def profile(
|
|
|
347
407
|
options (FtProfileOptions): Options for the command.
|
|
348
408
|
|
|
349
409
|
Returns:
|
|
350
|
-
FtProfileResponse: A two-element array. The first element contains results of query being profiled, the second element
|
|
410
|
+
FtProfileResponse: A two-element array. The first element contains results of query being profiled, the second element
|
|
411
|
+
stores profiling information.
|
|
351
412
|
|
|
352
413
|
Examples:
|
|
353
|
-
>>> ftSearchOptions = FtSeachOptions(
|
|
354
|
-
|
|
414
|
+
>>> ftSearchOptions = FtSeachOptions(
|
|
415
|
+
... return_fields=[
|
|
416
|
+
... ReturnField(field_identifier="a", alias="a_new"),
|
|
417
|
+
... ReturnField(field_identifier="b", alias="b_new")
|
|
418
|
+
... ]
|
|
419
|
+
... )
|
|
420
|
+
>>> await ft.profile(
|
|
421
|
+
... glide_client,
|
|
422
|
+
... "myIndex",
|
|
423
|
+
... FtProfileOptions.from_query_options(query="*", queryOptions=ftSearchOptions)
|
|
424
|
+
... )
|
|
355
425
|
[
|
|
356
426
|
[
|
|
357
427
|
2,
|