Skip to content

Add Metadata V1 deletion APIs and Data V2 pagination - #204

Open
priya-ni wants to merge 2 commits into
mainfrom
users/pgopal/update-python-grpc-client
Open

priya-ni wants to merge 2 commits into
mainfrom
users/pgopal/update-python-grpc-client

Conversation

@priya-ni

@priya-ni priya-ni commented Nov 11, 2026 •

Copy link
Copy Markdown

What does this Pull Request accomplish?

  • Adds single and batch Metadata V1 deletion methods, with tests and documentation.
  • Adds Data V2 pagination parameters and next_page_token support while retaining next_link as a compatibility alias.
  • Adds Measurement keyword support to match the pinned Data V2 proto.
  • Temporarily pins the Metadata V1 client/proto and Data V2 proto to upstream commit 72f6068c27af07ba8dcf3e2b2f71e4f6838ffe22.

Why should this Pull Request be merged?

It brings the high-level client in line with the merged upstream deletion APIs and Data V2 pagination contract. The Git pins are temporary until the corresponding packages are published to PyPI; then they can be replaced with version constraints.

What testing has been done?

  • pytest tests/unit -q: 485 passed
  • Black formatting check passed
  • Mypy passed
  • Editor diagnostics and git diff --check passed

@priya-ni priya-ni changed the title Update has_children functionality Add Metadata V1 deletion APIs and Data V2 pagination Nov 19, 2026
@priya-ni

Copy link
Copy Markdown
Author

The dependency pins are temporary while the updated packages are being published. Once the packages are publicly available on PyPI, I’ll update pyproject.toml to use the published versions and regenerate poetry.lock.

The publish workflows for the pinned upstream commit are:

@priya-ni
priya-ni marked this pull request as ready for review November 19, 2026 08:57
@priya-ni
priya-ni requested a review from a team as a code owner November 19, 2026 08:57
@priya-ni
priya-ni requested review from kaviarasu-ni and a balanced review from Copilot November 19, 2026 08:57

Copilot AI left a comment

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.

🟡 Changes recommended

Git-based dependencies block PyPI and TestPyPI uploads, while passing a bare string to batch_delete_aliases can delete unrelated alias registrations.

2 open issues
What changed in this PR

This PR aligns the high-level Python datastore client with upstream Metadata V1 deletion APIs and Data V2 pagination contracts.

Changes:

  • Adds single-item and batch metadata deletion methods, tests, and documentation.
  • Adds pagination tokens while retaining next_link as an alias, plus measurement keywords and output-only step child indicators.
  • Temporarily pins three upstream client/proto dependencies to a specific Git commit.
File Description
tests/​unit/​metadata/​test_delete_metadata.py Tests deletion request forwarding and force options.
tests/​unit/​data/​test_v2_types.py Tests keywords, child indicators, and field mappings.
tests/​unit/​data/​test_v2_data_store_client.py Tests pagination parameters, tokens, and read masks.
src/​ni/​datastore/​metadata/​_metadata_store_client.py Adds single-item and batch deletion wrappers.
src/​ni/​datastore/​data/​v2/​_types/​_step.py Adds output-only has_children support.
src/​ni/​datastore/​data/​v2/​_types/​_read_fields.py Adds child-indicator and keyword read fields.
src/​ni/​datastore/​data/​v2/​_types/​_query_results.py Adds continuation tokens with a legacy alias.
src/​ni/​datastore/​data/​v2/​_types/​_measurement.py Adds measurement keyword storage and conversion.
src/​ni/​datastore/​data/​v2/​_types/​_create.py Adds typed measurement keyword creation input.
src/​ni/​datastore/​data/​v2/​_data_store_client.py Forwards pagination parameters and returns tokens.
pyproject.toml Pins upstream dependencies to a Git commit.
poetry.lock Records updated dependency versions and Git sources.
docs/​reference/​ni-metadata-store.md Documents deletion APIs and force behavior.
docs/​reference/​ni-data-store-v2.md Documents pagination, keywords, and child indicators.

Review effort: Balanced

Comment thread pyproject.toml
Comment on lines +44 to +47
ni-measurements-metadata-v1-client = { git = "https://github.com/ni/ni-apis-python.git", rev = "72f6068c27af07ba8dcf3e2b2f71e4f6838ffe22", subdirectory = "packages/ni.measurements.metadata.v1.client" }
ni-measurements-metadata-v1-proto = { git = "https://github.com/ni/ni-apis-python.git", rev = "72f6068c27af07ba8dcf3e2b2f71e4f6838ffe22", subdirectory = "packages/ni.measurements.metadata.v1.proto" }
ni-measurements-data-v2-client = { version = ">=1.0.0.dev0", allow-prereleases = true }
ni-measurements-data-v2-proto = { version = ">=1.0.0.dev0", allow-prereleases = true }
ni-measurements-data-v2-proto = { git = "https://github.com/ni/ni-apis-python.git", rev = "72f6068c27af07ba8dcf3e2b2f71e4f6838ffe22", subdirectory = "packages/ni.measurements.data.v2.proto" }
Comment on lines +807 to +808
request = BatchDeleteAliasesRequest(
requests=[DeleteAliasRequest(alias_name=alias_name) for alias_name in alias_names]
| 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

page_size: Maximum number of test results to return. Zero uses the service default.
page_token: Token from a previous response used to retrieve the next page.

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.

I think it would be helpful to explain the behavior when page_token is a blank string (the default case).

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.

This applies to other Query methods in this file as well.

CreateUutInstanceRequest,
CreateUutRequest,
DeleteAliasRequest,
BatchDeleteAliasesRequest,

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.

You may have gotten a formatting error about this, but I would recommend keeping these imports in alphabetical order. These BatchDelete* lines should go above the Create* lines.

delete_response = self._get_metadata_store_client().delete_alias(delete_request)
return delete_response.unregistered

def delete_uut_instance(self, uut_instance_id: str, *, force: bool = False) -> None:

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.

The rest of the file groups methods together by metadata entity type. I would recommend putting delete_uut_instance and batch_delete_uut_instances directly after query_uut_instances. The same goes for the other entity types. This makes the diff more spread out, but it keeps things consistent with the current organization of the file.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants