Schemas
Schema
A schema is a set of rules that datasets need to adhere to.
It ensures datasets follow a well-known structure and context, which is both convenient for researchers and applications processing the datasets. Schemas can be created by scope admins and can be set as a default within the scope. With a default schema, datasets can be validated automatically, based on the validation level.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scope_uid
|
UID
|
UID of the scope in which to create the schema. |
required |
name
|
NonEmptyString256
|
Name of the schema. |
required |
uid
|
Optional[UID]
|
UID of the schema (will be set to the schema name if not given). |
None
|
schema
|
DictStrAny
|
The schema in JSON format. |
required |
example
|
DictStrAny
|
An example dataset in JSON format to verify the schema against. |
required |
Notes
Creating and modifying schema objects in QDL requires scope admin privileges.
See Also
SDK documentation for enabling automatic dataset validation based on a default schema.
create
Create the local schema in QDL.
Raises:
| Type | Description |
|---|---|
QdlSdkException
|
HTTP error code with description. |
description
property
writable
Description of the schema.
example
property
writable
Serialized dataset in JSON format which complies with this schema.
exists
classmethod
Check if the schema with the given scope UID and UID exists in QDL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scope_uid
|
UID
|
Scope UID of the schema. |
required |
uid
|
UID
|
UID of the schema. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True when the schema exists, otherwise False. |
Raises:
| Type | Description |
|---|---|
QdlSdkException
|
HTTP error code with description. |
get
classmethod
Get the schema with the given scope UID and UID from QDL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scope_uid
|
UID
|
Scope UID of the schema. |
required |
uid
|
UID
|
UID of the schema. |
required |
Returns:
| Type | Description |
|---|---|
Schema
|
Schema instance from QDL. |
Raises:
| Type | Description |
|---|---|
QdlSdkException
|
HTTP error code with description. |
list
classmethod
Get the schema(s) with the given scope UID from QDL.
Optionally, add additional filters as keyword arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scope_uid
|
UID
|
Scope UID of the schema(s). |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
uid |
str
|
UID of the schema. |
name |
str
|
Name of the schema(s). |
uuid |
str
|
UUID of the schema. |
dataset_uid |
str
|
UID of a dataset which is part of the schema(s). |
Returns:
| Type | Description |
|---|---|
List[Schema]
|
List with the (filtered) schema instance(s) from QDL. Returns an empty list when no matches are found. |
Raises:
| Type | Description |
|---|---|
QdlSdkException
|
HTTP error code with description. |
name
property
writable
Name of the schema.
schema
property
writable
Schema to validate datasets against.
scope
property
writable
Scope UID of the schema.
uid
property
writable
UID of the schema.
uuid
property
writable
UUID of the schema.