Skip to content

Better error message on conflicting dataset metadata when updating using API #9

@feixieliz

Description

@feixieliz

Description:

It appears that when using the client.update_dataset_metadata(request) method to update the dataset metadata, it will return the following error if the dataset already has metadata:
invariant_sdk.types.exceptions.InvariantError: Error calling method: PUT for path: /api/v1/dataset/metadata/your_dataset_name

Reproduction of the issue:

After successfully pushing traces to explorer using client.push_trace(request) and client.update_dataset_metadata(request), repeating the second command will trigger the above error.

Suggestion:

  • It would be helpful to have a specific error message just like those for error code 500, 401, 404:
    if response.status_code == 500:
    raise InvariantAPIError(
    f"Server error caused failure when calling method: {method} for path: {pathname}."
    ) from e
    if response.status_code == 401:
    raise InvariantAuthError(
    f"Authentication failed when calling method: {method} for path: {pathname}."
    ) from e
    if response.status_code == 404:
    This one returns 403.
  • Add a feature to overwrite the old metadata for update (such as a force=true parameter) or add a feature to delete the old metadata (supporting a DELETE request only targeting metadata) without needing to delete the whole dataset.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions