Skip to content

Commit

Permalink
RSDK-9339: Update python doc strings for tabular_data_by_sql/mql (#792)
Browse files Browse the repository at this point in the history
Co-authored-by: Sierra Guequierre <[email protected]>
  • Loading branch information
jckras and sguequierre authored Nov 22, 2024
1 parent 2a87532 commit 1f3c282
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/viam/app/data_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ async def tabular_data_by_sql(self, organization_id: str, sql_query: str) -> Lis
sql_query (str): The SQL query to run.
Returns:
List[Dict[str, ValueTypes]]: An array of data objects.
List[Dict[str, Union[ValueTypes, datetime]]]: An array of decoded BSON data objects.
For more information, see `Data Client API <https://docs.viam.com/appendix/apis/data-client/>`_.
"""
Expand All @@ -274,31 +274,23 @@ async def tabular_data_by_mql(self, organization_id: str, mql_binary: List[bytes
import bson
# using bson package (pip install bson)
tabular_data = await data_client.tabular_data_by_mql(organization_id="<YOUR-ORG-ID>", mql_binary=[
bson.dumps({ '$match': { 'location_id': '<YOUR-LOCATION-ID>' } }),
bson.dumps({ '$limit': 5 })
])
print(f"Tabular Data 1: {tabular_data}")
# using pymongo package (pip install pymongo)
tabular_data = await data_client.tabular_data_by_mql(organization_id="<YOUR-ORG-ID>", mql_binary=[
bson.encode({ '$match': { 'location_id': '<YOUR-LOCATION-ID>' } }),
bson.encode({ "$limit": 5 })
])
print(f"Tabular Data 2: {tabular_data}")
print(f"Tabular Data: {tabular_data}")
Args:
organization_id (str): The ID of the organization that owns the data.
You can obtain your organization ID from the Viam app's organization settings page.
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
`pymongo` or `bson`.
`pymongo`.
Returns:
List[Dict[str, ValueTypes]]: An array of data objects.
List[Dict[str, Union[ValueTypes, datetime]]]: An array of decoded BSON data objects.
For more information, see `Data Client API <https://docs.viam.com/appendix/apis/data-client/>`_.
"""
Expand Down

0 comments on commit 1f3c282

Please sign in to comment.