@@ -259,7 +259,7 @@ async def tabular_data_by_sql(self, organization_id: str, sql_query: str) -> Lis
259
259
sql_query (str): The SQL query to run.
260
260
261
261
Returns:
262
- List[Dict[str, ValueTypes]] : An array of data objects.
262
+ List[Dict[str, Union[ ValueTypes, datetime]]] : An array of decoded BSON data objects.
263
263
264
264
For more information, see `Data Client API <https://docs.viam.com/appendix/apis/data-client/>`_.
265
265
"""
@@ -274,31 +274,23 @@ async def tabular_data_by_mql(self, organization_id: str, mql_binary: List[bytes
274
274
275
275
import bson
276
276
277
- # using bson package (pip install bson)
278
- tabular_data = await data_client.tabular_data_by_mql(organization_id="<YOUR-ORG-ID>", mql_binary=[
279
- bson.dumps({ '$match': { 'location_id': '<YOUR-LOCATION-ID>' } }),
280
- bson.dumps({ '$limit': 5 })
281
- ])
282
-
283
- print(f"Tabular Data 1: {tabular_data}")
284
-
285
277
# using pymongo package (pip install pymongo)
286
278
tabular_data = await data_client.tabular_data_by_mql(organization_id="<YOUR-ORG-ID>", mql_binary=[
287
279
bson.encode({ '$match': { 'location_id': '<YOUR-LOCATION-ID>' } }),
288
280
bson.encode({ "$limit": 5 })
289
281
])
290
282
291
- print(f"Tabular Data 2 : {tabular_data}")
283
+ print(f"Tabular Data: {tabular_data}")
292
284
293
285
294
286
Args:
295
287
organization_id (str): The ID of the organization that owns the data.
296
288
You can obtain your organization ID from the Viam app's organization settings page.
297
289
mql_binary (List[bytes]): The MQL query to run as a list of BSON queries. You can encode your bson queries using a library like
298
- `pymongo` or `bson` .
290
+ `pymongo`.
299
291
300
292
Returns:
301
- List[Dict[str, ValueTypes]] : An array of data objects.
293
+ List[Dict[str, Union[ ValueTypes, datetime]]] : An array of decoded BSON data objects.
302
294
303
295
For more information, see `Data Client API <https://docs.viam.com/appendix/apis/data-client/>`_.
304
296
"""
0 commit comments