Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCS-3087: Add Python export tabular data to automation #3834

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/sdk_protos_map.csv
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ billing,GetInvoicePdf,,get_invoice_pdf,,

## Data
data,GetLatestTabularData,,get_latest_tabular_data,,
data,ExportTabularData,,export_tabular_data,,
data,TabularDataByFilter,,tabular_data_by_filter,,
data,TabularDataBySQL,,tabular_data_by_sql,,
data,TabularDataByMQL,,tabular_data_by_mql,,
Expand Down
1 change: 1 addition & 0 deletions static/include/app/apis/generated/data-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
| Method Name | Description |
| ----------- | ----------- |
| [`GetLatestTabularData`](/dev/reference/apis/data-client/#getlatesttabulardata) | Gets the most recent tabular data captured from the specified data source, as long as it was synced within the last year. |
| [`ExportTabularData`](/dev/reference/apis/data-client/#exporttabulardata) | Obtain unified tabular data and metadata from the specified data source. |
| [`TabularDataByFilter`](/dev/reference/apis/data-client/#tabulardatabyfilter) | Retrieve optionally filtered tabular data from the Viam app. |
| [`TabularDataBySQL`](/dev/reference/apis/data-client/#tabulardatabysql) | Obtain unified tabular data and metadata, queried with SQL. |
| [`TabularDataByMQL`](/dev/reference/apis/data-client/#tabulardatabymql) | Obtain unified tabular data and metadata, queried with MQL. |
Expand Down
40 changes: 40 additions & 0 deletions static/include/app/apis/generated/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,46 @@ For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/
{{% /tab %}}
{{< /tabs >}}

### ExportTabularData

Obtain unified tabular data and metadata from the specified data source.

{{< tabs >}}
{{% tab name="Python" %}}

**Parameters:**

- `part_id` ([str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)) (required): The ID of the part that owns the data.
- `resource_name` ([str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)) (required): The name of the requested resource that captured the data.
- `resource_subtype` ([str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)) (required): The subtype of the requested resource that captured the data.
- `method_name` ([str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)) (required): The data capture method name.
- `start_time` ([datetime.datetime](https://docs.python.org/3/library/datetime.html)) (optional): Optional start time for requesting a specific range of data.
- `end_time` ([datetime.datetime](https://docs.python.org/3/library/datetime.html)) (optional): Optional end time for requesting a specific range of data.

**Returns:**

- ([List[TabularDataPoint]](https://python.viam.dev/autoapi/viam/app/data_client/index.html#viam.app.data_client.DataClient.TabularDataPoint)): The unified tabular data and metadata.

**Example:**

```python {class="line-numbers linkable-line-numbers"}
tabular_data = await data_client.export_tabular_data(
part_id="<PART-ID>",
resource_name="<RESOURCE-NAME>",
resource_subtype="<RESOURCE-SUBTYPE>",
method_name="<METHOD-NAME>",
start_time="<START_TIME>"
end_time="<END_TIME>"
)

print(f"My data: {tabular_data}")
```

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/app/data_client/index.html#viam.app.data_client.DataClient.export_tabular_data).

{{% /tab %}}
{{< /tabs >}}

### TabularDataByFilter

Retrieve optionally filtered tabular data from the [Viam app](https://app.viam.com).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Obtain unified tabular data and metadata from the specified data source.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my own understanding, does this need to be here because the automation wouldn't pull this description from the Python SDK and only looks to the proto which doesn't have this description? Wouldn't it be better to edit https://github.com/viamrobotics/api/blob/3f0b40a80d223721fce7e385afe026aeeb6bd4fc/proto/viam/app/data/v1/data.proto#L24 instead of creating an override?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it wasn't working for me if I didn't create an override, it gave me an error and didn't pick up the description properly. @npentrel have you encountered this before? I don't understand the automation well enough currently to easily fix it but I could take a stab if necessary.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes the automation requires it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and yes this is not ideal but not something that's easy to fix at the moment.

Loading