@@ -237,18 +237,10 @@ def __import_json(
237237 file_name : str ,
238238 cl : wvc .ConsistencyLevel ,
239239 num_objects : Optional [int ] = None ,
240- alias : Optional [str ] = None ,
241240 ) -> int :
242241 counter = 0
243- if alias is None :
244- properties : List [wvc .Property ] = collection .config .get ().properties
245- else :
246- collection_from_alias = self .client .alias .get (alias_name = alias ).collection
247- properties : List [wvc .Property ] = (
248- self .client .collections .get (collection_from_alias )
249- .config .get ()
250- .properties
251- )
242+
243+ properties : List [wvc .Property ] = collection .config .get ().properties
252244
253245 try :
254246 with (
@@ -451,20 +443,13 @@ def __ingest_data(
451443 uuid : Optional [str ] = None ,
452444 verbose : bool = False ,
453445 multi_vector : bool = False ,
454- alias : Optional [str ] = None ,
455446 ) -> Collection :
456447 if randomize :
457448 click .echo (f"Generating { num_objects } objects" )
458449 start_time = time .time ()
459450
460451 # Determine vector dimensions based on vectorizer
461- if alias is None :
462- config = collection .config .get ()
463- else :
464- collection_from_alias = self .client .alias .get (
465- alias_name = alias
466- ).collection
467- config = self .client .collections .get (collection_from_alias ).config .get ()
452+ config = collection .config .get ()
468453
469454 if not config .vectorizer and config .vector_config :
470455 # Named vectors
@@ -599,11 +584,9 @@ def __ingest_data(
599584 )
600585 return cl_collection
601586 else :
602- click .echo (
603- f"Importing { num_objects } objects from Movies dataset { 'using alias' if alias else '' } "
604- )
587+ click .echo (f"Importing { num_objects } objects from Movies dataset" )
605588 num_objects_inserted = self .__import_json (
606- collection , "movies.json" , cl , num_objects , alias
589+ collection , "movies.json" , cl , num_objects
607590 )
608591 print (
609592 f"Inserted { num_objects_inserted } objects into class '{ collection .name } '"
@@ -627,16 +610,12 @@ def create_data(
627610 multi_vector : bool = CreateDataDefaults .multi_vector ,
628611 ) -> Collection :
629612
630- alias = None
631613 if not self .client .collections .exists (collection ):
632614 alias_list = self .client .alias .list_all ()
633615 if collection not in alias_list .keys ():
634616 raise Exception (
635617 f"Class '{ collection } ' does not exist in Weaviate. Create first using <create class> command"
636618 )
637- else :
638- alias = collection
639- collection = str (alias_list [collection ].collection )
640619
641620 col : Collection = self .client .collections .get (collection )
642621 mt_enabled = col .config .get ().multi_tenancy_config .enabled
@@ -705,9 +684,7 @@ def create_data(
705684 if tenant == "None" :
706685 initial_length = len (col )
707686 collection = self .__ingest_data (
708- collection = (
709- col if alias is None else self .client .collections .get (alias )
710- ),
687+ collection = col ,
711688 num_objects = limit ,
712689 cl = cl_map [consistency_level ],
713690 randomize = randomize ,
@@ -716,7 +693,6 @@ def create_data(
716693 uuid = uuid ,
717694 verbose = verbose ,
718695 multi_vector = multi_vector ,
719- alias = alias ,
720696 )
721697 after_length = len (col )
722698 else :
@@ -739,11 +715,7 @@ def create_data(
739715 initial_length = len (col .with_tenant (tenant ))
740716 click .echo (f"Processing objects for tenant '{ tenant } '" )
741717 collection = self .__ingest_data (
742- collection = (
743- col .with_tenant (tenant )
744- if alias is None
745- else self .client .collections .get (alias ).with_tenant (tenant )
746- ),
718+ collection = col .with_tenant (tenant ),
747719 num_objects = limit ,
748720 cl = cl_map [consistency_level ],
749721 randomize = randomize ,
@@ -752,7 +724,6 @@ def create_data(
752724 uuid = uuid ,
753725 verbose = verbose ,
754726 multi_vector = multi_vector ,
755- alias = alias ,
756727 )
757728 after_length = len (col .with_tenant (tenant ))
758729 if wait_for_indexing :
@@ -983,16 +954,12 @@ def update_data(
983954 verbose : bool = UpdateDataDefaults .verbose ,
984955 ) -> None :
985956
986- alias = None
987957 if not self .client .collections .exists (collection ):
988958 alias_list = self .client .alias .list_all ()
989959 if collection not in alias_list .keys ():
990960 raise Exception (
991961 f"Class '{ collection } ' does not exist in Weaviate. Create first using ./create_class.py"
992962 )
993- else :
994- alias = collection
995- collection = str (alias_list [collection ].collection )
996963
997964 col : Collection = self .client .collections .get (collection )
998965 try :
@@ -1012,8 +979,6 @@ def update_data(
1012979 }
1013980
1014981 click .echo (f"Preparing to update { limit } objects into class '{ col .name } '" )
1015- # Override collection if alias is provided
1016- col = col if alias is None else self .client .collections .get (alias )
1017982 for tenant in tenants :
1018983 if tenant == "None" :
1019984 ret = self .__update_data (
@@ -1130,18 +1095,12 @@ def delete_data(
11301095 verbose : bool = DeleteDataDefaults .verbose ,
11311096 ) -> None :
11321097
1133- alias = None
11341098 if not self .client .collections .exists (collection ):
11351099 alias_list = self .client .alias .list_all ()
11361100 if collection not in alias_list .keys ():
11371101 raise Exception (
11381102 f"Class '{ collection } ' does not exist in Weaviate. Create first using <create class> command."
11391103 )
1140- else :
1141- alias = collection
1142- collection = str (alias_list [collection ].collection )
1143-
1144- return 1
11451104
11461105 col : Collection = self .client .collections .get (collection )
11471106 mt_enabled = col .config .get ().multi_tenancy_config .enabled
@@ -1161,9 +1120,6 @@ def delete_data(
11611120 else :
11621121 tenants = existing_tenants
11631122
1164- # Override collection if alias is provided
1165- col = col if alias is None else self .client .collections .get (alias )
1166-
11671123 for tenant in tenants :
11681124 if tenant == "None" :
11691125 ret = self .__delete_data (
@@ -1264,16 +1220,12 @@ def query_data(
12641220 target_vector : Optional [str ] = QueryDataDefaults .target_vector ,
12651221 ) -> None :
12661222
1267- alias = None
12681223 if not self .client .collections .exists (collection ):
12691224 alias_list = self .client .alias .list_all ()
12701225 if collection not in alias_list .keys ():
12711226 raise Exception (
12721227 f"Class '{ collection } ' does not exist in Weaviate. Create first using <create class> command."
12731228 )
1274- else :
1275- alias = collection
1276- collection = str (alias_list [collection ].collection )
12771229
12781230 col : Collection = self .client .collections .get (collection )
12791231 mt_enabled = col .config .get ().multi_tenancy_config .enabled
@@ -1303,8 +1255,6 @@ def query_data(
13031255 "all" : wvc .ConsistencyLevel .ALL ,
13041256 "one" : wvc .ConsistencyLevel .ONE ,
13051257 }
1306- # Override collection if alias is provided
1307- col = col if alias is None else self .client .collections .get (alias )
13081258
13091259 for tenant in existing_tenants :
13101260 if tenant == "None" :
0 commit comments