valkey-glide 2.1.1rc2__cp313-cp313-macosx_11_0_arm64.whl → 2.1.1rc3__cp313-cp313-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.

Potentially problematic release.


This version of valkey-glide might be problematic. Click here for more details.

@@ -1062,39 +1062,70 @@ class ClusterCommands(CoreCommands):
1062
1062
  await self._execute_command(RequestType.FlushDB, args, route),
1063
1063
  )
1064
1064
 
1065
- async def copy(
1066
- self,
1067
- source: TEncodable,
1068
- destination: TEncodable,
1069
- replace: Optional[bool] = None,
1070
- ) -> bool:
1071
1065
  """
1072
- Copies the value stored at the `source` to the `destination` key. When `replace` is True,
1073
- removes the `destination` key first if it already exists, otherwise performs no action.
1066
+ Copies the value stored at the `source` to the `destination` key. If `destinationDB`
1067
+ is specified, the value will be copied to the database specified by `destinationDB`,
1068
+ otherwise the current database will be used. When `replace` is True, removes the
1069
+ `destination` key first if it already exists, otherwise performs no action.
1074
1070
 
1075
1071
  See [valkey.io](https://valkey.io/commands/copy) for more details.
1076
1072
 
1077
- Note:
1078
- Both `source` and `destination` must map to the same hash slot.
1079
-
1080
1073
  Args:
1081
1074
  source (TEncodable): The key to the source value.
1082
1075
  destination (TEncodable): The key where the value should be copied to.
1076
+ destinationDB (Optional[Union[int, str]]): The alternative logical database index for the destination key.
1083
1077
  replace (Optional[bool]): If the destination key should be removed before copying the value to it.
1084
1078
 
1085
1079
  Returns:
1086
- bool: True if the source was copied. Otherwise, returns False.
1080
+ bool: True if the source was copied. Otherwise, return False.
1087
1081
 
1088
1082
  Examples:
1089
1083
  >>> await client.set("source", "sheep")
1090
- >>> await client.copy(b"source", b"destination")
1091
- True # Source was copied
1084
+ >>> await client.copy(b"source", b"destination", destinationDB=1)
1085
+ True # Source was copied to DB 1
1086
+ >>> await client.select(1)
1092
1087
  >>> await client.get("destination")
1093
1088
  b"sheep"
1094
1089
 
1095
- Since: Valkey version 6.2.0.
1090
+ Since: Valkey version 9.0.0.
1091
+ """
1092
+ ...
1093
+
1094
+ async def copy(
1095
+ self,
1096
+ source: TEncodable,
1097
+ destination: TEncodable,
1098
+ # TODO next major release the arguments replace and destinationDB must have their order
1099
+ # swapped to align with the standalone order.
1100
+ # At the moment of the patch release 2.1.1. we can't have a breaking change
1101
+ replace: Optional[bool] = None,
1102
+ destinationDB: Optional[int] = None,
1103
+ ) -> bool:
1104
+ """
1105
+ Copies the value stored at the `source` to the `destination` key.
1106
+
1107
+ This method supports two signatures:
1108
+ 1. copy(source, destination, replace=None) - original API
1109
+ 2. copy(source, destination, replace=None, destinationDB=None) - new API with DB support
1110
+
1111
+ When `replace` is True, removes the `destination` key first if it already exists,
1112
+ otherwise performs no action.
1113
+
1114
+ See [valkey.io](https://valkey.io/commands/copy) for more details.
1115
+
1116
+ Note:
1117
+ When `destinationDB` is not provided, both `source` and `destination` must map to the same hash slot.
1096
1118
  """
1119
+ # Handle backward compatibility for positional arguments
1120
+ # If destinationDB is a boolean, it's likely the old API: copy(source, destination, replace)
1121
+ if isinstance(destinationDB, bool):
1122
+ replace = destinationDB
1123
+ destinationDB = None
1124
+
1125
+ # Build command arguments
1097
1126
  args: List[TEncodable] = [source, destination]
1127
+ if destinationDB is not None:
1128
+ args.extend(["DB", str(destinationDB)])
1098
1129
  if replace is True:
1099
1130
  args.append("REPLACE")
1100
1131
  return cast(
@@ -2270,6 +2270,20 @@ class CoreCommands(Protocol):
2270
2270
  """
2271
2271
  return cast(int, await self._execute_command(RequestType.SAdd, [key] + members))
2272
2272
 
2273
+ async def select(self, index: int) -> TOK:
2274
+ """
2275
+ Change the currently selected database.
2276
+
2277
+ See [valkey.io](https://valkey.io/commands/select/) for details.
2278
+
2279
+ Args:
2280
+ index (int): The index of the database to select.
2281
+
2282
+ Returns:
2283
+ A simple OK response.
2284
+ """
2285
+ return cast(TOK, await self._execute_command(RequestType.Select, [str(index)]))
2286
+
2273
2287
  async def srem(self, key: TEncodable, members: List[TEncodable]) -> int:
2274
2288
  """
2275
2289
  Remove specified members from the set stored at `key`.
@@ -162,42 +162,6 @@ class StandaloneCommands(CoreCommands):
162
162
  timeout=timeout,
163
163
  )
164
164
 
165
- async def select(self, index: int) -> TOK:
166
- """
167
- Change the currently selected database.
168
-
169
- **WARNING**: This command is NOT RECOMMENDED for production use.
170
- Upon reconnection, the client will revert to the database_id specified
171
- in the client configuration (default: 0), NOT the database selected
172
- via this command.
173
-
174
- **RECOMMENDED APPROACH**: Use the database_id parameter in client
175
- configuration instead:
176
-
177
- ```python
178
- client = await GlideClient.create_client(
179
- GlideClientConfiguration(
180
- addresses=[NodeAddress("localhost", 6379)],
181
- database_id=5 # Recommended: persists across reconnections
182
- )
183
- )
184
- ```
185
-
186
- **RECONNECTION BEHAVIOR**: After any reconnection (due to network issues,
187
- timeouts, etc.), the client will automatically revert to the database_id
188
- specified during client creation, losing any database selection made via
189
- this SELECT command.
190
-
191
- See [valkey.io](https://valkey.io/commands/select/) for details.
192
-
193
- Args:
194
- index (int): The index of the database to select.
195
-
196
- Returns:
197
- A simple OK response.
198
- """
199
- return cast(TOK, await self._execute_command(RequestType.Select, [str(index)]))
200
-
201
165
  async def config_resetstat(self) -> TOK:
202
166
  """
203
167
  Resets the statistics reported by the server using the INFO and LATENCY HISTOGRAM commands.
Binary file
@@ -5885,7 +5885,11 @@ class ClusterBatch(BaseBatch):
5885
5885
  self,
5886
5886
  source: TEncodable,
5887
5887
  destination: TEncodable,
5888
+ # TODO next major release the arguments replace and destinationDB must have their order
5889
+ # swapped to align with the standalone order.
5890
+ # At the moment of the patch release 2.1.1. we can't have a breaking change
5888
5891
  replace: Optional[bool] = None,
5892
+ destinationDB: Optional[int] = None,
5889
5893
  ) -> "ClusterBatch":
5890
5894
  """
5891
5895
  Copies the value stored at the `source` to the `destination` key. When `replace` is True,
@@ -5897,15 +5901,17 @@ class ClusterBatch(BaseBatch):
5897
5901
  source (TEncodable): The key to the source value.
5898
5902
  destination (TEncodable): The key where the value should be copied to.
5899
5903
  replace (Optional[bool]): If the destination key should be removed before copying the value to it.
5900
-
5904
+ destinationDB (Optional[int]): The alternative logical database index for the destination key.
5901
5905
  Command response:
5902
5906
  bool: True if the source was copied.
5903
5907
 
5904
5908
  Otherwise, return False.
5905
5909
 
5906
- Since: Valkey version 6.2.0.
5910
+ Since: Valkey version 9.0.0.
5907
5911
  """
5908
5912
  args = [source, destination]
5913
+ if destinationDB is not None:
5914
+ args.extend(["DB", str(destinationDB)])
5909
5915
  if replace is not None:
5910
5916
  args.append("REPLACE")
5911
5917
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: valkey-glide
3
- Version: 2.1.1rc2
3
+ Version: 2.1.1rc3
4
4
  Classifier: Topic :: Database
5
5
  Classifier: Topic :: Utilities
6
6
  Classifier: License :: OSI Approved :: Apache Software License
@@ -1,11 +1,11 @@
1
- valkey_glide-2.1.1rc2.dist-info/METADATA,sha256=KWk9vN70VroErcvOfkOZNADxlpIWZ7GdFRbw8aPRHoY,6978
2
- valkey_glide-2.1.1rc2.dist-info/WHEEL,sha256=FabLtVAh6wjYVuVsk3fFy2vDHzt-2LksyDpo-NsnDNY,106
1
+ valkey_glide-2.1.1rc3.dist-info/METADATA,sha256=hlIous9dfGwwLPBIdYtJZABbkyDd3OwFyQ398V3a-gw,6978
2
+ valkey_glide-2.1.1rc3.dist-info/WHEEL,sha256=FabLtVAh6wjYVuVsk3fFy2vDHzt-2LksyDpo-NsnDNY,106
3
3
  glide/async_commands/glide_json.py,sha256=H5dnB4vJkGPpNXJZhhVyPQoTSbkN_chq5Xw6tkP0wMQ,60410
4
4
  glide/async_commands/ft.py,sha256=1v96sBCgiXtPbj85ZurY3ruLCmok3cPoaIXSiJBEv9Y,16849
5
5
  glide/async_commands/__init__.py,sha256=_tbTAFATlzp4L2qe-H77PpAQK-16VsV-y7uKNUKLC_o,136
6
- glide/async_commands/core.py,sha256=XGnO7RjJwNDAiTk1NUqGrSeDhTE9f35VzKl1qRs29oo,329202
7
- glide/async_commands/standalone_commands.py,sha256=yG855laN2P69KKn2wBgWnH7HaZwvwQYUMghRfYQ0X6k,39553
8
- glide/async_commands/cluster_commands.py,sha256=Lji6eo2LaoXwy4Ha3e6bcGOHyMQHdDBiSQLt1kf9gGo,60129
6
+ glide/async_commands/core.py,sha256=K-aEjJqzfCNRLzm_DhFWCGgoEy6SggG-6EL5rsGtvEc,329613
7
+ glide/async_commands/standalone_commands.py,sha256=Io98Ebd96xXbw4DYoDJcKxTpxcaMteQ8sxeaTv0UuDk,38228
8
+ glide/async_commands/cluster_commands.py,sha256=y1Viyz-TpatVu1wPzEmBJsifJWUhHotQrUGDWwYoOI8,61722
9
9
  glide/__init__.py,sha256=6FuOMIsm52UiKxJsb2dUj06vwCT8DOsxZDqxMx8d6vQ,8767
10
10
  glide/glide.pyi,sha256=6JIpAeADQ-1fU1Mp99pyh7aJORDxAAdtQebV5aByIVI,2093
11
11
  glide/opentelemetry.py,sha256=vg9fTYXj7_rni7hVBkZBJ1ZN4-RSGde5fOH4DsnVx_4,7476
@@ -13,7 +13,7 @@ glide/glide_client.py,sha256=lIxvEkMsUG6Ura42dDrFbP8OPYJ1bXk-LsFf4eN5fwo,32594
13
13
  glide/logger.py,sha256=5-bAhfH_6hYEXdcgBR9R_wdeffSLHqEN-aQeIyMHnYY,4103
14
14
  glide_shared/__init__.py,sha256=Jgl61tWsX5n1F1a5_rxPvWBuMkBYtJ7gCLFRDPwGV8o,7141
15
15
  glide_shared/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- glide_shared/commands/batch.py,sha256=cGsjfyLqhfQjFaLcDcO18iMHnvBm81YMxk_aBPP7q00,246881
16
+ glide_shared/commands/batch.py,sha256=Ji-Ljo0lgd_9jcwVfklNns8Crfqavtlgb33k_8Duj8g,247356
17
17
  glide_shared/commands/batch_options.py,sha256=i2lDCLhMzUvpArb2bxX16xu7X-im0hLPaLXALkxWeQ8,11130
18
18
  glide_shared/commands/bitmap.py,sha256=ZHGLcKBP7RADtANqIR7PWdIW_gfDBFgpkIsQ-T4QFBQ,10125
19
19
  glide_shared/commands/command_args.py,sha256=55vpSxeQr8wFU7olkFTEecl66wPk1g6vWxVYj16UvXs,2529
@@ -35,5 +35,5 @@ glide_shared/protobuf/connection_request_pb2.py,sha256=b3jDmMetSHUrZGmQd8b5DooZZ
35
35
  glide_shared/protobuf/response_pb2.py,sha256=oT2GHUwjrxvBVdINRKCvb3_BFN0Fq2wqwHbTj7KAX2E,2110
36
36
  glide_shared/protobuf_codec.py,sha256=xwt4-D4WbvNIY_vjOd-00c73HOyNjWq7nN-Z718PBVA,3667
37
37
  glide_shared/routes.py,sha256=HFccxCzXQXSi6Y1HFsRUm9ZcbJgCrar6y6uOWpGJWe0,4746
38
- glide/glide.cpython-313-darwin.so,sha256=gJL5bYCqcRir6U_IBUT-HP80eb-YlXIDYBcjrSfpgA4,9891712
39
- valkey_glide-2.1.1rc2.dist-info/RECORD,,
38
+ glide/glide.cpython-313-darwin.so,sha256=hDRBQpZY7w4JrorSeXq5PmexO8hzoWkGKxRfEW9juAk,9891744
39
+ valkey_glide-2.1.1rc3.dist-info/RECORD,,