File tree Expand file tree Collapse file tree
test/unittests/test_managers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -146,6 +146,7 @@ def test_update_collection(mock_client):
146146 description = "Updated description" ,
147147 vector_index = "hnsw" ,
148148 async_enabled = True ,
149+ replication_factor = 5 ,
149150 auto_tenant_creation = True ,
150151 auto_tenant_activation = True ,
151152 replication_deletion_strategy = "delete_on_conflict" ,
@@ -157,7 +158,7 @@ def test_update_collection(mock_client):
157158 == "Updated description"
158159 )
159160 assert (
160- mock_collection .config .update .call_args .kwargs ["replication_config" ].factor == 3
161+ mock_collection .config .update .call_args .kwargs ["replication_config" ].factor == 5
161162 )
162163 assert (
163164 mock_collection .config .update .call_args .kwargs [
Original file line number Diff line number Diff line change @@ -38,6 +38,12 @@ def update() -> None:
3838 type = bool ,
3939 help = "Enable async (default: None)." ,
4040)
41+ @click .option (
42+ "--replication_factor" ,
43+ default = UpdateCollectionDefaults .replication_factor ,
44+ type = int ,
45+ help = "Replication factor (default: None)." ,
46+ )
4147@click .option (
4248 "--vector_index" ,
4349 default = UpdateCollectionDefaults .vector_index ,
@@ -81,6 +87,7 @@ def update_collection_cli(
8187 ctx : click .Context ,
8288 collection : str ,
8389 async_enabled : Optional [bool ],
90+ replication_factor : Optional [int ],
8491 vector_index : Optional [str ],
8592 description : Optional [str ],
8693 training_limit : int ,
@@ -98,6 +105,7 @@ def update_collection_cli(
98105 collection_man .update_collection (
99106 collection = collection ,
100107 async_enabled = async_enabled ,
108+ replication_factor = replication_factor ,
101109 vector_index = vector_index ,
102110 description = description ,
103111 training_limit = training_limit ,
Original file line number Diff line number Diff line change @@ -187,6 +187,7 @@ class RestoreBackupDefaults:
187187class UpdateCollectionDefaults :
188188 collection : str = "Movies"
189189 async_enabled : Optional [bool ] = None
190+ replication_factor : Optional [int ] = None
190191 vector_index : Optional [str ] = None
191192 description : Optional [str ] = None
192193 training_limit : int = 10000
Original file line number Diff line number Diff line change @@ -274,6 +274,7 @@ def update_collection(
274274 vector_index : Optional [str ] = UpdateCollectionDefaults .vector_index ,
275275 training_limit : int = UpdateCollectionDefaults .training_limit ,
276276 async_enabled : Optional [bool ] = UpdateCollectionDefaults .async_enabled ,
277+ replication_factor : Optional [int ] = UpdateCollectionDefaults .replication_factor ,
277278 auto_tenant_creation : Optional [
278279 bool
279280 ] = UpdateCollectionDefaults .auto_tenant_creation ,
@@ -316,7 +317,11 @@ def update_collection(
316317 }
317318
318319 col_obj : Collection = self .client .collections .get (collection )
319- rf = col_obj .config .get ().replication_config .factor
320+ rf = (
321+ replication_factor
322+ if replication_factor is not None
323+ else col_obj .config .get ().replication_config .factor
324+ )
320325 rds_map = {
321326 "delete_on_conflict" : wvc .ReplicationDeletionStrategy .DELETE_ON_CONFLICT ,
322327 "no_automated_resolution" : wvc .ReplicationDeletionStrategy .NO_AUTOMATED_RESOLUTION ,
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ def get_client(self) -> weaviate.WeaviateClient:
118118 headers = self .config ["headers" ] if "headers" in self .config else None ,
119119 )
120120 elif self .config ["host" ].endswith ("weaviate.cloud" ):
121- return weaviate .connect_to_wcs (
121+ return weaviate .connect_to_weaviate_cloud (
122122 cluster_url = self .config ["host" ],
123123 auth_credentials = auth_config ,
124124 headers = self .config ["headers" ] if "headers" in self .config else None ,
You can’t perform that action at this time.
0 commit comments