Skip to content

Commit 787c605

Browse files
authored
DATA-3756 Update TabularDataByMQL to have optional bool for use_recent_data (#845)
1 parent b67f405 commit 787c605

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/viam/app/data_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ async def tabular_data_by_sql(self, organization_id: str, sql_query: str) -> Lis
346346

347347
@_alias_param("query", param_alias="mql_binary")
348348
async def tabular_data_by_mql(
349-
self, organization_id: str, query: Union[List[bytes], List[Dict[str, Any]]]
349+
self, organization_id: str, query: Union[List[bytes], List[Dict[str, Any]]], use_recent_data: Optional[bool] = None
350350
) -> List[Dict[str, Union[ValueTypes, datetime]]]:
351351
"""Obtain unified tabular data and metadata, queried with MQL.
352352
@@ -367,14 +367,15 @@ async def tabular_data_by_mql(
367367
query (Union[List[bytes], List[Dict[str, Any]]]): The MQL query to run, as a list of MongoDB aggregation pipeline stages.
368368
Note: Each stage can be provided as either a dictionary or raw BSON bytes, but support for bytes will be removed in the future,
369369
so using a dictionary is preferred.
370+
use_recent_data (bool): Whether to query blob storage or your recent data store. Defaults to `False`
370371
371372
Returns:
372373
List[Dict[str, Union[ValueTypes, datetime]]]: An array of decoded BSON data objects.
373374
374375
For more information, see `Data Client API <https://docs.viam.com/dev/reference/apis/data-client/#tabulardatabymql>`_.
375376
"""
376377
binary: List[bytes] = [bson.encode(query) for query in query] if isinstance(query[0], dict) else query # type: ignore
377-
request = TabularDataByMQLRequest(organization_id=organization_id, mql_binary=binary)
378+
request = TabularDataByMQLRequest(organization_id=organization_id, mql_binary=binary, use_recent_data=use_recent_data)
378379
response: TabularDataByMQLResponse = await self._data_client.TabularDataByMQL(request, metadata=self._metadata)
379380
return [bson.decode(bson_bytes) for bson_bytes in response.raw_data]
380381

0 commit comments

Comments
 (0)