Skip to content
Open
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
29 changes: 26 additions & 3 deletions docs/reference/ni-data-store-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,28 @@ extensions as dictionaries. Queries accept an OData expression and optional
`MeasurementField`, for example `read_fields=[StepField.CONDITIONS]`; field names
as strings are also accepted.

Measurements also accept optional classification labels through `keywords`; use
`read_fields=[MeasurementField.KEYWORDS]` to request them from a query or get.

Queries support pagination with `page_size` and `page_token`. A zero `page_size`
uses the service default. Pass the previous result's `next_page_token` to fetch
the following page:

```python
page = client.query_steps(page_size=100)
if page.next_page_token:
next_page = client.query_steps(page_size=100, page_token=page.next_page_token)
```

`QueryResults.next_link` remains as a compatibility alias; new code should use
`next_page_token`.

`Step.has_children` is output-only and can be requested with
`read_fields=[StepField.HAS_CHILDREN]`. It becomes true after the step has had a
committed direct child and remains true even if that child is later deleted.
The installed V2 proto package must include the field for its value to be read;
older generated packages report it as false.

Updates change only the fields named in the protobuf update mask, and the client
builds the mask for you. Pass a `Step`, or its ID, with keyword fields, an update
builder, or the whole object:
Expand Down Expand Up @@ -121,7 +143,7 @@ The client wraps every method of the V2 low-level client:
passed instead of IDs to find or create them.
- `create_measurement` accepts `SoftwareItem`, `HardwareItem`, and
`TestAdapter` objects for inline find-or-create, in addition to their IDs.
- `query_*` methods return `QueryResults`, a list with a `next_link` attribute
- `query_*` methods return `QueryResults`, a list with a `next_page_token` attribute
that is set when the service has more results.
- JSON values and conditions accept a plain dictionary, or `JsonValue` when the
value needs attributes. Reads return a `JsonValue` only when attributes are
Expand All @@ -146,8 +168,9 @@ The client wraps every method of the V2 low-level client:
Timestamps must use `datetime.timezone.utc`; other time zones are rejected.
Round trips are exact to about 1 ns; finer precision is not preserved.
- Test results and steps accept `keywords`, and test results accept `uut_id`
updates. Keywords, duration, and `uut_id` are stored once the service delivers
the Stage 2 New Resource Fields feature.
updates. Those Stage 2 fields are stored once the service delivers the New
Resource Fields feature. Measurements accept their own optional classification
`keywords` on create and read.
- Measurement values are converted to scalar, vector, supported NI
waveform-family, or JSON values; `read_measurement_value` converts them back to
Python or nitypes values. The `MeasurementValue` type lists the values that can
Expand Down
34 changes: 34 additions & 0 deletions docs/reference/ni-metadata-store.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,40 @@ This comprehensive metadata foundation enables powerful queries such as:
- "Find all tests using outdated software versions"
- "Correlate test failures with specific test descriptions or procedures"

## Deleting Metadata

`MetadataStoreClient` supports deleting individual metadata entries and deleting multiple entries
with one batch request:

| Entry | Delete one | Delete a batch |
| --- | --- | --- |
| UUT instance | `delete_uut_instance` | `batch_delete_uut_instances` |
| UUT | `delete_uut` | `batch_delete_uuts` |
| Operator | `delete_operator` | `batch_delete_operators` |
| Test description | `delete_test_description` | `batch_delete_test_descriptions` |
| Test | `delete_test` | `batch_delete_tests` |
| Test station | `delete_test_station` | `batch_delete_test_stations` |
| Hardware item | `delete_hardware_item` | `batch_delete_hardware_items` |
| Software item | `delete_software_item` | `batch_delete_software_items` |
| Test adapter | `delete_test_adapter` | `batch_delete_test_adapters` |
| Schema | `delete_schema` | `batch_delete_schemas` |
| Alias | `delete_alias` | `batch_delete_aliases` |

Single-item methods accept the corresponding ID, or alias name. Batch methods accept an iterable

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please remove this comma.

Suggested change
Single-item methods accept the corresponding ID, or alias name. Batch methods accept an iterable
Single-item methods accept the corresponding ID or alias name. Batch methods accept an iterable

of IDs or alias names. Methods return `None` after a successful deletion, except `delete_alias`,
which returns whether the alias was unregistered. Service errors, including errors for missing or
referenced entries, are propagated to the caller.

Entity deletion methods that support `force` default to `False`; for batch methods, the option
applies to each requested entry. Force behavior depends on the entity type. For example, forcing
UUT deletion also deletes its UUT instances. Schema deletion clears schema associations but retains
the metadata and extension attributes; alias deletion only removes the alias, not its target.

```python
metadata_store_client.delete_software_item("software-item-id")
metadata_store_client.batch_delete_tests(["test-id-1", "test-id-2"], force=True)
```

## **Extensibility**
All metadata entities support custom extensions through:
- **Extension fields** - Custom key-value pairs for entity-specific data
Expand Down
Loading
Loading