2727 CaptureInterval ,
2828 CaptureMetadata ,
2929 ConfigureDatabaseUserRequest ,
30+ CreateIndexRequest ,
3031 DataRequest ,
3132 DataServiceStub ,
3233 DeleteBinaryDataByFilterRequest ,
3334 DeleteBinaryDataByFilterResponse ,
3435 DeleteBinaryDataByIDsRequest ,
3536 DeleteBinaryDataByIDsResponse ,
37+ DeleteIndexRequest ,
3638 DeleteTabularDataRequest ,
3739 DeleteTabularDataResponse ,
3840 ExportTabularDataRequest ,
4244 GetDatabaseConnectionResponse ,
4345 GetLatestTabularDataRequest ,
4446 GetLatestTabularDataResponse ,
47+ Index ,
48+ IndexableCollection ,
49+ ListIndexesRequest ,
50+ ListIndexesResponse ,
4551 Order ,
4652 RemoveBinaryDataFromDatasetByIDsRequest ,
4753 RemoveBoundingBoxFromImageByIDRequest ,
@@ -499,6 +505,7 @@ async def tabular_data_by_mql(
499505 use_recent_data : Optional [bool ] = None ,
500506 tabular_data_source_type : TabularDataSourceType .ValueType = TabularDataSourceType .TABULAR_DATA_SOURCE_TYPE_STANDARD ,
501507 pipeline_id : Optional [str ] = None ,
508+ query_prefix_name : Optional [str ] = None ,
502509 ) -> List [Dict [str , Union [ValueTypes , datetime ]]]:
503510 """Obtain unified tabular data and metadata, queried with MQL.
504511
@@ -525,6 +532,7 @@ async def tabular_data_by_mql(
525532 Defaults to `TABULAR_DATA_SOURCE_TYPE_STANDARD`.
526533 pipeline_id (str): The ID of the data pipeline to query. Defaults to `None`.
527534 Required if `tabular_data_source_type` is `TABULAR_DATA_SOURCE_TYPE_PIPELINE_SINK`.
535+ query_prefix_name (str): Optional field that can be used to specify a saved query to run.
528536
529537 Returns:
530538 List[Dict[str, Union[ValueTypes, datetime]]]: An array of decoded BSON data objects.
@@ -535,7 +543,12 @@ async def tabular_data_by_mql(
535543 data_source = TabularDataSource (type = tabular_data_source_type , pipeline_id = pipeline_id )
536544 if use_recent_data :
537545 data_source .type = TabularDataSourceType .TABULAR_DATA_SOURCE_TYPE_HOT_STORAGE
538- request = TabularDataByMQLRequest (organization_id = organization_id , mql_binary = binary , data_source = data_source )
546+ request = TabularDataByMQLRequest (
547+ organization_id = organization_id ,
548+ mql_binary = binary ,
549+ data_source = data_source ,
550+ query_prefix_name = query_prefix_name ,
551+ )
539552 response : TabularDataByMQLResponse = await self ._data_client .TabularDataByMQL (request , metadata = self ._metadata )
540553 return [bson .decode (bson_bytes ) for bson_bytes in response .raw_data ]
541554
@@ -1131,8 +1144,8 @@ async def add_bounding_box_to_image_by_id(
11311144
11321145 Args:
11331146 binary_id (Union[~viam.proto.app.data.BinaryID, str]): The binary data ID or :class:`BinaryID` of the image to add the bounding
1134- box to. *DEPRECATED:* :class:`BinaryID` *is deprecated and will be removed in a future release. Instead, pass binary data
1135- IDs as a list of strings.*
1147+ box to. *DEPRECATED:* :class:`BinaryID` *is deprecated and will be removed in a future release. Instead, pass binary data IDs as a
1148+ list of strings.*
11361149 label (str): A label for the bounding box.
11371150 x_min_normalized (float): Min X value of the bounding box normalized from 0 to 1.
11381151 y_min_normalized (float): Min Y value of the bounding box normalized from 0 to 1.
@@ -2061,6 +2074,86 @@ async def _list_data_pipeline_runs(self, id: str, page_size: int, page_token: st
20612074 response : ListDataPipelineRunsResponse = await self ._data_pipelines_client .ListDataPipelineRuns (request , metadata = self ._metadata )
20622075 return DataClient .DataPipelineRunsPage .from_proto (response , self , page_size )
20632076
2077+ async def create_index (
2078+ self ,
2079+ organization_id : str ,
2080+ collection_type : IndexableCollection .ValueType ,
2081+ index_spec : Dict [str , Any ],
2082+ pipeline_name : Optional [str ] = None ,
2083+ ) -> None :
2084+ """Starts a custom index build.
2085+
2086+ Args:
2087+ organization_id (str): The ID of the organization that owns the data.
2088+ To find your organization ID, visit the organization settings page.
2089+ collection_type (IndexableCollection.ValueType): The type of collection the index is on.
2090+ index_spec (List[Dict[str, Any]]): The MongoDB index specification defined in JSON format.
2091+ pipeline_name (Optional[str]): The name of the pipeline if the collection type is PIPELINE_SINK.
2092+
2093+ For more information, see `Data Client API <https://docs.viam.com/dev/reference/apis/data-client/#createindex>`_.
2094+ """
2095+ index_spec_bytes = [bson .encode (index_spec )]
2096+ request = CreateIndexRequest (
2097+ organization_id = organization_id ,
2098+ collection_type = collection_type ,
2099+ index_spec = index_spec_bytes ,
2100+ pipeline_name = pipeline_name ,
2101+ )
2102+ await self ._data_client .CreateIndex (request , metadata = self ._metadata )
2103+
2104+ async def list_indexes (
2105+ self ,
2106+ organization_id : str ,
2107+ collection_type : IndexableCollection .ValueType ,
2108+ pipeline_name : Optional [str ] = None ,
2109+ ) -> Sequence [Index ]:
2110+ """Returns all the indexes for a given collection.
2111+
2112+ Args:
2113+ organization_id (str): The ID of the organization that owns the data.
2114+ To find your organization ID, visit the organization settings page.
2115+ collection_type (IndexableCollection.ValueType): The type of collection the index is on.
2116+ pipeline_name (Optional[str]): The name of the pipeline if the collection type is PIPELINE_SINK.
2117+
2118+ Returns:
2119+ List[Index]: A list of indexes.
2120+
2121+ For more information, see `Data Client API <https://docs.viam.com/dev/reference/apis/data-client/#listindexes>`_.
2122+ """
2123+ request = ListIndexesRequest (
2124+ organization_id = organization_id ,
2125+ collection_type = collection_type ,
2126+ pipeline_name = pipeline_name ,
2127+ )
2128+ response : ListIndexesResponse = await self ._data_client .ListIndexes (request , metadata = self ._metadata )
2129+ return response .indexes
2130+
2131+ async def delete_index (
2132+ self ,
2133+ organization_id : str ,
2134+ collection_type : IndexableCollection .ValueType ,
2135+ index_name : str ,
2136+ pipeline_name : Optional [str ] = None ,
2137+ ) -> None :
2138+ """Drops the specified custom index from a collection.
2139+
2140+ Args:
2141+ organization_id (str): The ID of the organization that owns the data.
2142+ To find your organization ID, visit the organization settings page.
2143+ collection_type (IndexableCollection.ValueType): The type of collection the index is on.
2144+ index_name (str): The name of the index to delete.
2145+ pipeline_name (Optional[str]): The name of the pipeline if the collection type is PIPELINE_SINK.
2146+
2147+ For more information, see `Data Client API <https://docs.viam.com/dev/reference/apis/data-client/#deleteindex>`_.
2148+ """
2149+ request = DeleteIndexRequest (
2150+ organization_id = organization_id ,
2151+ collection_type = collection_type ,
2152+ index_name = index_name ,
2153+ pipeline_name = pipeline_name ,
2154+ )
2155+ await self ._data_client .DeleteIndex (request , metadata = self ._metadata )
2156+
20642157 @staticmethod
20652158 def create_filter (
20662159 component_name : Optional [str ] = None ,
0 commit comments