From 954083ab0fe80dfd7f6bb71af1e665ea0adf7776 Mon Sep 17 00:00:00 2001 From: Sierra Guequierre Date: Fri, 13 Sep 2024 11:29:59 -0400 Subject: [PATCH 1/7] Clean up data client API code samples --- docs/examples/example.ipynb | 3 +- src/viam/app/data_client.py | 188 +++++++++++++++++++++++------------- 2 files changed, 123 insertions(+), 68 deletions(-) diff --git a/docs/examples/example.ipynb b/docs/examples/example.ipynb index 4ac1b7da8..15bcd4c37 100644 --- a/docs/examples/example.ipynb +++ b/docs/examples/example.ipynb @@ -1272,8 +1272,9 @@ ], "source": [ "from datetime import datetime\n", + "from viam.utils import create_filter\n", "\n", - "left_motor_filter = data_client.create_filter(\n", + "left_motor_filter = create_filter(\n", " component_name=\"left_motor\", start_time=datetime(2023, 6, 5, 11), end_time=datetime(2023, 6, 5, 13, 30), tags=[\"speed_test_run\"]\n", ")\n", "\n", diff --git a/src/viam/app/data_client.py b/src/viam/app/data_client.py index 162b5591d..4abbe0a8a 100644 --- a/src/viam/app/data_client.py +++ b/src/viam/app/data_client.py @@ -177,14 +177,13 @@ async def tabular_data_by_filter( from viam.proto.app.data import Filter - my_data = [] - last = None - my_filter = Filter(component_name="left_motor") - while True: - tabular_data, count, last = await data_client.tabular_data_by_filter(my_filter, last) - if not tabular_data: - break - my_data.extend(tabular_data) + left_motor_filter = create_filter( + component_name="motor-1" + ) + + data, count, last = await data_client.tabular_data_by_filter(filter=left_motor_filter) + for tab in data: + print(tab) Args: @@ -194,9 +193,9 @@ async def tabular_data_by_filter( sort_order (viam.proto.app.data.Order): The desired sort order of the data. last (str): Optional string indicating the ID of the last-returned data. If provided, the server will return the next data entries after the `last` ID. - count_only (bool): Whether to return only the total count of entries. + count_only (bool): Whether to return only the total count of entries. Optional. include_internal_data (bool): Whether to return the internal data. Internal data is used for Viam-specific data ingestion, - like cloud SLAM. Defaults to `False` + like cloud SLAM. Optional, defaults to `False`. dest (str): Optional filepath for writing retrieved data. Returns: @@ -239,7 +238,10 @@ async def tabular_data_by_sql(self, organization_id: str, sql_query: str) -> Lis :: - data = await data_client.tabular_data_by_sql(org_id="", sql_query="SELECT * FROM readings LIMIT 5") + data = await data_client.tabular_data_by_sql( + org_id="", + sql_query="SELECT * FROM readings LIMIT 5" + ) Args: @@ -259,17 +261,42 @@ async def tabular_data_by_mql(self, organization_id: str, mql_binary: List[bytes :: # using bson import bson - tabular_data = await data_client.tabular_data_by_mql(org_id="", mql_binary=[ - bson.dumps({ '$match': { 'location_id': '' } }), - bson.dumps({ "$limit": 5 }) - ]) + import bson.json_util + + def mql_to_binary(mql_pipeline): + binary_pipeline = [] + for stage in mql_pipeline: + # Parse the JSON string to a Python dict + parsed_stage = bson.json_util.loads(stage) + # Convert the dict to BSON + bson_stage = bson.BSON.encode(parsed_stage) + binary_pipeline.append(bson_stage) + return binary_pipeline + + mql_pipeline=[ + bson.json_util.dumps({ '$match': { 'location_id': '' } }), + bson.json_util.dumps({ "$limit": 5 }) + ] + + binary_pipeline = mql_to_binary(mql_pipeline) + + # using bson dumps + tabular_data = await data_client.tabular_data_by_mql( + organization_id="", + mql_binary=binary_pipeline + ) - # using pymongo - import bson - tabular_data = await data_client.tabular_data_by_mql(org_id="", mql_binary=[ - bson.encode({ '$match': { 'location_id': '' } }), - bson.encode({ "$limit": 5 }) - ]) + print(f"Tabular Data 1: {tabular_data}") + + # using encoding + tabular_data = await data_client.tabular_data_by_mql( + organization_id="", + mql_binary=[ + bson.BSON.encode({ '$match': { 'location_id': '' } }), + bson.BSON.encode({ "$limit": 5 }) + ]) + + print(f"Tabular Data 2: {tabular_data}") Args: @@ -304,14 +331,17 @@ async def binary_data_by_filter( from viam.proto.app.data import Filter - my_data = [] - last = None - my_filter = Filter(component_name="camera") - while True: - data, count, last = await data_client.binary_data_by_filter(my_filter, last) - if not data: - break - my_data.extend(data) + camera_filter = create_filter( + component_name="camera-1" + ) + + data, count, last = await data_client.binary_data_by_filter( + filter=camera_filter, + limit=1, + include_binary_data=True + ) + for binary in data: + print(binary) Args: filter (viam.proto.app.data.Filter): Optional `Filter` specifying tabular data to retrieve. No `Filter` implies all binary @@ -370,12 +400,12 @@ async def binary_data_by_ids( from viam.proto.app.data import BinaryID binary_metadata = await data_client.binary_data_by_filter( - include_file_data=False + include_binary_data=False ) my_ids = [] - for obj in binary_metadata: + for obj in binary_metadata[0]: my_ids.append( BinaryID( file_id=obj.metadata.id, @@ -412,12 +442,10 @@ async def delete_tabular_data(self, organization_id: str, delete_older_than_days :: - from viam.proto.app.data import Filter - - my_filter = Filter(component_name="left_motor") - days_of_data_to_delete = 10 tabular_data = await data_client.delete_tabular_data( - org_id="a12b3c4e-1234-1abc-ab1c-ab1c2d345abc", days_of_data_to_delete) + organization_id="", + delete_older_than_days=150 + ) Args: organization_id (str): ID of organization to delete data from. @@ -440,14 +468,15 @@ async def delete_binary_data_by_filter(self, filter: Optional[Filter]) -> int: :: - from viam.proto.app.data import Filter + from viam.utils import create_filter - my_filter = Filter(component_name="left_motor") + my_filter = create_filter(component_name="left_motor", organization_ids=[""]) res = await data_client.delete_binary_data_by_filter(my_filter) Args: filter (viam.proto.app.data.Filter): Optional `Filter` specifying binary data to delete. Passing an empty `Filter` will lead to - all data being deleted. Exercise caution when using this option. + all data being deleted. Exercise caution when using this option. You must specify any organization ID with + "organization_ids" when using this option. Returns: int: The number of items deleted. @@ -463,14 +492,18 @@ async def delete_binary_data_by_ids(self, binary_ids: List[BinaryID]) -> int: :: from viam.proto.app.data import BinaryID + from viam.utils import create_filter + my_filter = create_filter(component_name="camera-1", organization_ids=[""]) binary_metadata = await data_client.binary_data_by_filter( - include_file_data=False - ) + filter=my_filter, + limit=20, + include_binary_data=False + ) my_ids = [] - for obj in binary_metadata: + for obj in binary_metadata[0]: my_ids.append( BinaryID( file_id=obj.metadata.id, @@ -479,7 +512,7 @@ async def delete_binary_data_by_ids(self, binary_ids: List[BinaryID]) -> int: ) ) - binary_data = await data_client.delete_binary_data_by_ids(my_ids) + binary_data = await data_client.binary_data_by_ids(my_ids) Args: binary_ids (List[viam.proto.app.data.BinaryID]): `BinaryID` objects specifying the data to be deleted. Must be non-empty. @@ -500,16 +533,20 @@ async def add_tags_to_binary_data_by_ids(self, tags: List[str], binary_ids: List :: from viam.proto.app.data import BinaryID + from viam.utils import create_filter tags = ["tag1", "tag2"] + my_filter = create_filter(component_name="camera-1", organization_ids=[""]) binary_metadata = await data_client.binary_data_by_filter( - include_file_data=False - ) + filter=my_filter, + limit=20, + include_binary_data=False + ) my_ids = [] - for obj in binary_metadata: + for obj in binary_metadata[0]: my_ids.append( BinaryID( file_id=obj.metadata.id, @@ -559,16 +596,21 @@ async def remove_tags_from_binary_data_by_ids(self, tags: List[str], binary_ids: :: from viam.proto.app.data import BinaryID + from viam.utils import create_filter tags = ["tag1", "tag2"] + my_filter = create_filter(component_name="camera-1") + binary_metadata = await data_client.binary_data_by_filter( - include_file_data=False + filter=my_filter, + limit=50, + include_binary_data=False ) my_ids = [] - for obj in binary_metadata: + for obj in binary_metadata[0]: my_ids.append( BinaryID( file_id=obj.metadata.id, @@ -663,12 +705,12 @@ async def add_bounding_box_to_image_by_id( from viam.proto.app.data import BinaryID MY_BINARY_ID = BinaryID( - file_id=your-file_id, - organization_id=your-org-id, - location_id=your-location-id + file_id="", + organization_id="", + location_id="" ) - bbox_label = await data_client.add_bounding_box_to_image_by_id( + bbox_id = await data_client.add_bounding_box_to_image_by_id( binary_id=MY_BINARY_ID, label="label", x_min_normalized=0, @@ -677,7 +719,7 @@ async def add_bounding_box_to_image_by_id( y_max_normalized=.3 ) - print(bbox_label) + print(bbox_id) Args: binary_id (viam.proto.app.data.BinaryID): The ID of the image to add the bounding box to. @@ -740,6 +782,8 @@ async def bounding_box_labels_by_filter(self, filter: Optional[Filter] = None) - bounding_box_labels = await data_client.bounding_box_labels_by_filter( my_filter) + print(bounding_box_labels) + Args: filter (viam.proto.app.data.Filter): `Filter` specifying data to retrieve from. If no `Filter` is provided, all labels will return. @@ -757,7 +801,7 @@ async def get_database_connection(self, organization_id: str) -> str: :: - data_client.get_database_connection(org_id="a12b3c4e-1234-1abc-ab1c-ab1c2d345abc") + hostname = await data_client.get_database_connection(organization_id="") Args: organization_id (str): Organization to retrieve the connection for. @@ -773,6 +817,13 @@ async def configure_database_user(self, organization_id: str, password: str) -> """Configure a database user for the Viam organization's MongoDB Atlas Data Federation instance. It can also be used to reset the password of the existing database user. + :: + + await data_client.configure_database_user( + organization_id="", + password="Your_Password@1234" + ) + Args: organization_id (str): The ID of the organization. password (str): The password of the user. @@ -786,8 +837,8 @@ async def create_dataset(self, name: str, organization_id: str) -> str: :: name = await data_client.create_dataset( - name="", - organization_id="" + name="", + organization_id="" ) print(name) @@ -808,12 +859,13 @@ async def list_dataset_by_ids(self, ids: List[str]) -> Sequence[Dataset]: :: datasets = await data_client.list_dataset_by_ids( - ids=["abcd-1234xyz-8765z-123abc"] + ids=[", "] ) print(datasets) Args: - ids (List[str]): The IDs of the datasets being called for. + ids (List[str]): The IDs of the datasets being called for. You can retrieve these values by navigating to the **DATASETS** + sub-tab of the **DATA** tab, clicking on the dataset, clicking the **...** menu and selecting **Copy dataset ID**. Returns: Sequence[Dataset]: The list of datasets. @@ -828,8 +880,8 @@ async def list_datasets_by_organization_id(self, organization_id: str) -> Sequen :: - datasets = await data_client.list_dataset_by_ids( - ids=["abcd-1234xyz-8765z-123abc"] + datasets = await data_client.list_datasets_by_organization_id( + organization_id="YOUR-ORG-ID" ) print(datasets) @@ -852,12 +904,13 @@ async def rename_dataset(self, id: str, name: str) -> None: :: await data_client.rename_dataset( - id="abcd-1234xyz-8765z-123abc", - name="" + id="", + name="MyDataset" ) Args: - id (str): The ID of the dataset. + id (str): The ID of the dataset. You can retrieve this by navigating to the **DATASETS** sub-tab of the **DATA** tab, + clicking on the dataset, clicking the **...** menu and selecting **Copy dataset ID**. name (str): The new name of the dataset. """ request = RenameDatasetRequest(id=id, name=name) @@ -873,7 +926,8 @@ async def delete_dataset(self, id: str) -> None: ) Args: - id (str): The ID of the dataset. + id (str): The ID of the dataset. You can retrieve this by navigating to the **DATASETS** sub-tab of the **DATA** tab, + clicking on the dataset, clicking the **...** menu and selecting **Copy dataset ID**. """ request = DeleteDatasetRequest(id=id) await self._dataset_client.DeleteDataset(request, metadata=self._metadata) @@ -893,7 +947,7 @@ async def add_binary_data_to_dataset_by_ids(self, binary_ids: List[BinaryID], da my_binary_ids = [] - for obj in binary_metadata: + for obj in binary_metadata[0]: my_binary_ids.append( BinaryID( file_id=obj.metadata.id, @@ -929,7 +983,7 @@ async def remove_binary_data_from_dataset_by_ids(self, binary_ids: List[BinaryID my_binary_ids = [] - for obj in binary_metadata: + for obj in binary_metadata[0]: my_binary_ids.append( BinaryID( file_id=obj.metadata.id, @@ -1149,7 +1203,7 @@ async def streaming_data_capture_upload( component_type='motor', component_name='left_motor', method_name='IsPowered', - data_request_times=[(time_requested, time_received)], + data_request_times=[time_requested, time_received], tags=["tag_1", "tag_2"] ) From 6a6576c48b08c456c0966aa38ba60c2037df2b50 Mon Sep 17 00:00:00 2001 From: Sierra Guequierre Date: Fri, 13 Sep 2024 11:33:56 -0400 Subject: [PATCH 2/7] Apply suggestions from code review --- src/viam/app/data_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/viam/app/data_client.py b/src/viam/app/data_client.py index 4abbe0a8a..0e2779040 100644 --- a/src/viam/app/data_client.py +++ b/src/viam/app/data_client.py @@ -512,7 +512,7 @@ async def delete_binary_data_by_ids(self, binary_ids: List[BinaryID]) -> int: ) ) - binary_data = await data_client.binary_data_by_ids(my_ids) + binary_data = await data_client.delete_binary_data_by_ids(my_ids) Args: binary_ids (List[viam.proto.app.data.BinaryID]): `BinaryID` objects specifying the data to be deleted. Must be non-empty. From bb821a6f48a31f67b5b792c57232f967dac7949d Mon Sep 17 00:00:00 2001 From: Sierra Guequierre Date: Fri, 13 Sep 2024 13:09:28 -0400 Subject: [PATCH 3/7] fix whitespace --- src/viam/app/data_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/viam/app/data_client.py b/src/viam/app/data_client.py index f6607d92b..c3812aa14 100644 --- a/src/viam/app/data_client.py +++ b/src/viam/app/data_client.py @@ -242,7 +242,7 @@ async def tabular_data_by_sql(self, organization_id: str, sql_query: str) -> Lis """Obtain unified tabular data and metadata, queried with SQL. :: - + data = await data_client.tabular_data_by_sql( org_id="", sql_query="SELECT * FROM readings LIMIT 5" @@ -476,7 +476,7 @@ async def delete_tabular_data(self, organization_id: str, delete_older_than_days """Delete tabular data older than a specified number of days. :: - + tabular_data = await data_client.delete_tabular_data( organization_id="", delete_older_than_days=150 From 20c315bbc809e38ca6cb1dfc3304140841b1c716 Mon Sep 17 00:00:00 2001 From: Sierra Guequierre Date: Mon, 16 Sep 2024 15:00:54 -0400 Subject: [PATCH 4/7] Make edits from code review --- src/viam/app/data_client.py | 69 +++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/src/viam/app/data_client.py b/src/viam/app/data_client.py index c3812aa14..30332dc99 100644 --- a/src/viam/app/data_client.py +++ b/src/viam/app/data_client.py @@ -177,15 +177,16 @@ async def tabular_data_by_filter( :: - from viam.utils import create_filter - - left_motor_filter = create_filter( - component_name="motor-1" - ) + my_data = [] + my_filter = create_filter(component_name="motor-1") + last = None + while True: + tabular_data, count, last = await data_client.tabular_data_by_filter(my_filter, last=last) + if not tabular_data: + break + my_data.extend(tabular_data) - data, count, last = await data_client.tabular_data_by_filter(filter=left_motor_filter) - for tab in data: - print(tab) + print(f"My data: {my_data}") Args: filter (viam.proto.app.data.Filter): Optional `Filter` specifying tabular data to retrieve. No `Filter` implies all tabular @@ -293,7 +294,7 @@ def mql_to_binary(mql_pipeline): tabular_data = await data_client.tabular_data_by_mql( organization_id="", mql_binary=binary_pipeline - ) + ) print(f"Tabular Data 1: {tabular_data}") @@ -343,17 +344,19 @@ async def binary_data_by_filter( from viam.utils import create_filter from viam.proto.app.data import Filter, TagsFilter, TagsFilterType - camera_filter = create_filter( - component_name="camera-1" - ) + # Get data captured from camera components + my_data = [] + last = None + my_filter = create_filter(component_name="camera-1") - data, count, last = await data_client.binary_data_by_filter( - filter=camera_filter, - limit=1, - include_binary_data=True - ) - for binary in data: - print(binary) + while True: + data, count, last = await data_client.binary_data_by_filter( + my_filter, limit=1, last=last) + if not data: + break + my_data.extend(data) + + print(f"My data: {my_data}") # Get untagged data from a dataset @@ -432,13 +435,13 @@ async def binary_data_by_ids( from viam.proto.app.data import BinaryID - binary_metadata = await data_client.binary_data_by_filter( + binary_metadata, count, last = await data_client.binary_data_by_filter( include_binary_data=False ) my_ids = [] - for obj in binary_metadata[0]: + for obj in binary_metadata: my_ids.append( BinaryID( file_id=obj.metadata.id, @@ -480,7 +483,7 @@ async def delete_tabular_data(self, organization_id: str, delete_older_than_days tabular_data = await data_client.delete_tabular_data( organization_id="", delete_older_than_days=150 - ) + ) Args: organization_id (str): ID of organization to delete data from. @@ -536,15 +539,15 @@ async def delete_binary_data_by_ids(self, binary_ids: List[BinaryID]) -> int: from viam.utils import create_filter my_filter = create_filter(component_name="camera-1", organization_ids=[""]) - binary_metadata = await data_client.binary_data_by_filter( + binary_metadata, count, last = await data_client.binary_data_by_filter( filter=my_filter, limit=20, include_binary_data=False - ) + ) my_ids = [] - for obj in binary_metadata[0]: + for obj in binary_metadata: my_ids.append( BinaryID( file_id=obj.metadata.id, @@ -581,7 +584,7 @@ async def add_tags_to_binary_data_by_ids(self, tags: List[str], binary_ids: List tags = ["tag1", "tag2"] my_filter = create_filter(component_name="camera-1", organization_ids=[""]) - binary_metadata = await data_client.binary_data_by_filter( + binary_metadata, count, last = await data_client.binary_data_by_filter( filter=my_filter, limit=20, include_binary_data=False @@ -589,7 +592,7 @@ async def add_tags_to_binary_data_by_ids(self, tags: List[str], binary_ids: List my_ids = [] - for obj in binary_metadata[0]: + for obj in binary_metadata: my_ids.append( BinaryID( file_id=obj.metadata.id, @@ -649,7 +652,7 @@ async def remove_tags_from_binary_data_by_ids(self, tags: List[str], binary_ids: my_filter = create_filter(component_name="camera-1") - binary_metadata = await data_client.binary_data_by_filter( + binary_metadata, count, last = await data_client.binary_data_by_filter( filter=my_filter, limit=50, include_binary_data=False @@ -657,7 +660,7 @@ async def remove_tags_from_binary_data_by_ids(self, tags: List[str], binary_ids: my_ids = [] - for obj in binary_metadata[0]: + for obj in binary_metadata: my_ids.append( BinaryID( file_id=obj.metadata.id, @@ -1019,13 +1022,13 @@ async def add_binary_data_to_dataset_by_ids(self, binary_ids: List[BinaryID], da from viam.proto.app.data import BinaryID - binary_metadata, _, _ = await data_client.binary_data_by_filter( + binary_metadata, count, last = await data_client.binary_data_by_filter( include_binary_data=False ) my_binary_ids = [] - for obj in binary_metadata[0]: + for obj in binary_metadata: my_binary_ids.append( BinaryID( file_id=obj.metadata.id, @@ -1059,13 +1062,13 @@ async def remove_binary_data_from_dataset_by_ids(self, binary_ids: List[BinaryID from viam.proto.app.data import BinaryID - binary_metadata, _, _ = await data_client.binary_data_by_filter( + binary_metadata, count, last = await data_client.binary_data_by_filter( include_binary_data=False ) my_binary_ids = [] - for obj in binary_metadata[0]: + for obj in binary_metadata: my_binary_ids.append( BinaryID( file_id=obj.metadata.id, From 498e227e8ae4c1ef2a7b32337b19a11a1b4f08d4 Mon Sep 17 00:00:00 2001 From: Sierra Guequierre Date: Wed, 18 Sep 2024 15:44:57 -0400 Subject: [PATCH 5/7] apply suggestions from code review --- src/viam/app/data_client.py | 45 ++++++++++--------------------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/src/viam/app/data_client.py b/src/viam/app/data_client.py index 30332dc99..f90ff5977 100644 --- a/src/viam/app/data_client.py +++ b/src/viam/app/data_client.py @@ -269,42 +269,21 @@ async def tabular_data_by_mql(self, organization_id: str, mql_binary: List[bytes :: - # using bson import bson - import bson.json_util - - def mql_to_binary(mql_pipeline): - binary_pipeline = [] - for stage in mql_pipeline: - # Parse the JSON string to a Python dict - parsed_stage = bson.json_util.loads(stage) - # Convert the dict to BSON - bson_stage = bson.BSON.encode(parsed_stage) - binary_pipeline.append(bson_stage) - return binary_pipeline - - mql_pipeline=[ - bson.json_util.dumps({ '$match': { 'location_id': '' } }), - bson.json_util.dumps({ "$limit": 5 }) - ] - - binary_pipeline = mql_to_binary(mql_pipeline) - - # using bson dumps - tabular_data = await data_client.tabular_data_by_mql( - organization_id="", - mql_binary=binary_pipeline - ) + + # using bson package (pip install bson) + tabular_data = await data_client.tabular_data_by_mql(organization_id="", mql_binary=[ + bson.dumps({ '$match': { 'location_id': '' } }), + bson.dumps({ '$limit': 5 }) + ]) print(f"Tabular Data 1: {tabular_data}") - # using encoding - tabular_data = await data_client.tabular_data_by_mql( - organization_id="", - mql_binary=[ - bson.BSON.encode({ '$match': { 'location_id': '' } }), - bson.BSON.encode({ "$limit": 5 }) - ]) + # using pymongo package (pip install pymongo) + tabular_data = await data_client.tabular_data_by_mql(organization_id="", mql_binary=[ + bson.BSON.encode({ '$match': { 'location_id': '' } }), + bson.BSON.encode({ "$limit": 5 }) + ]) print(f"Tabular Data 2: {tabular_data}") @@ -588,7 +567,7 @@ async def add_tags_to_binary_data_by_ids(self, tags: List[str], binary_ids: List filter=my_filter, limit=20, include_binary_data=False - ) + ) my_ids = [] From 1f56fdea09f88cc14f093958899ca02d760132b8 Mon Sep 17 00:00:00 2001 From: Sierra Guequierre Date: Wed, 18 Sep 2024 15:49:30 -0400 Subject: [PATCH 6/7] fixup --- src/viam/app/data_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/viam/app/data_client.py b/src/viam/app/data_client.py index f90ff5977..4f81a6414 100644 --- a/src/viam/app/data_client.py +++ b/src/viam/app/data_client.py @@ -883,7 +883,7 @@ async def create_dataset(self, name: str, organization_id: str) -> str: :: - name = await data_client.create_dataset( + dataset_id = await data_client.create_dataset( name="", organization_id="" ) From d6c6f1ba42230b33ce371cff2ba43476b93a31c3 Mon Sep 17 00:00:00 2001 From: Sierra Guequierre Date: Thu, 19 Sep 2024 10:12:20 -0400 Subject: [PATCH 7/7] fixup --- src/viam/app/data_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/viam/app/data_client.py b/src/viam/app/data_client.py index 4f81a6414..5719025c6 100644 --- a/src/viam/app/data_client.py +++ b/src/viam/app/data_client.py @@ -281,8 +281,8 @@ async def tabular_data_by_mql(self, organization_id: str, mql_binary: List[bytes # using pymongo package (pip install pymongo) tabular_data = await data_client.tabular_data_by_mql(organization_id="", mql_binary=[ - bson.BSON.encode({ '$match': { 'location_id': '' } }), - bson.BSON.encode({ "$limit": 5 }) + bson.encode({ '$match': { 'location_id': '' } }), + bson.encode({ "$limit": 5 }) ]) print(f"Tabular Data 2: {tabular_data}")