hopsworks.core.tag_schemas_api #
TagSchemasApi #
Manage the platform's typed tag-schema registry.
All write operations on this class require the platform-administrator role (HOPS_ADMIN); read operations require any authenticated user.
For backwards compatibility hopsworks.core.tag_schemas_api.TagSchemasApi is still available as hsfs.core.tag_schemas_api.TagSchemasApi. The use of this alias is discouraged as it is to be deprecated.
Returned by
create #
Register a new schematized tag.
Tag schemas are JSON-Schema definitions that constrain the value clients can attach via TagsApi.add(...). A schema must be valid JSON Schema (type, properties, etc.); the backend rejects malformed payloads.
Requires HOPS_ADMIN (platform administrator). Project-level Data Owner is not sufficient.
Example
from hopsworks_common.core.tag_schemas_api import TagSchemasApi
schema = {
"type": "object",
"properties": {
"owner": {"type": "string"},
"version": {"type": "integer"},
},
"required": ["owner"],
}
TagSchemasApi().create("ownership", schema)
| PARAMETER | DESCRIPTION |
|---|---|
name | Unique schema name (used later by clients to attach tag instances to entities). TYPE: |
schema | JSON-Schema definition. May be a Python dict (the preferred form) or a JSON string already serialized. |
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any] | The created schema payload as returned by the backend. |
| RAISES | DESCRIPTION |
|---|---|
PermissionError | If the caller lacks |
ValueError | If |
hopsworks.client.exceptions.RestAPIError | If the schema payload is rejected by the backend (invalid JSON Schema, duplicate name, etc.). |
delete #
delete(name: str) -> None
Remove a tag schema from the registry.
Requires HOPS_ADMIN. Project-level Data Owner is not sufficient.
| PARAMETER | DESCRIPTION |
|---|---|
name | Schema name. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
PermissionError | If the caller lacks |
hopsworks.client.exceptions.RestAPIError | If the schema does not exist or the backend otherwise rejects the request. |
get #
Fetch a single tag schema by name.
| PARAMETER | DESCRIPTION |
|---|---|
name | Schema name. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any] | The raw schema payload from the backend. |
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the schema does not exist. |