Knowledge Object YAML Reference
This page documents every attribute available in a Knowledge Object YAML definition. Each file declares one object per YAML document; you can define multiple objects in one file by separating them with---.
Top-level structure
name and at least one field, and at least one of those fields must be a primary key:
fields
The list of columns that make up the object. Every field is validated on deploy; an unknown attribute or an unsupported type fails the deploy.
Field types
By default each type maps to a sensible database column type. Use
db_type to override the exact type.
Primary keys
At least one field must haveprimary_key: true. The combination of primary key fields uniquely identifies an instance, and it is used to compute the stable instance key (_key).
- Primary key fields cannot be optional.
- Primary key fields are immutable — attempting to change one through the API is an error. A different primary key is a different instance.
Defaults
default sets a database-level default that the database applies whenever the field is omitted from an insert. This means the default is enforced regardless of how the instance is created — through the API, or directly against the table.
Because it is a database expression, you can use functional defaults:
A field with a
default may be omitted when creating an instance — the database fills it in. Functional defaults such as now() can only be produced at insert time, so the client should leave the field out rather than sending a value.Mutability
Setmutable: false to freeze a field after the instance is created. Non-primary-key fields are mutable by default.
Custom database columns and types
Usedb_column and db_type to control the underlying database storage independently of the field name and logical type:
Relationships
A relationship field holds the primary key value of an instance of another object. It is metadata only — there is no database-level foreign key. IfCompany.owner points at Person, whose primary key is id, then owner holds a Person’s id.
relationshipmust reference exactly one related object.- The field’s
typemust bestr,int, ordate. Astrfield can hold any key type; anintordatefield must match the type of the key field it holds. - If the related object has a composite primary key, declare one field per key field, each with
relationship.fieldset to the key field it holds. Together they form one link, and each key field must be covered once. - On create and update, the value must match an existing instance of the related object, or the write returns
400. A composite link must be set completely or left empty.
Shipment points at an OrderLine keyed by (order_id, line_no):
add_relationships flag — see the Instance API. In the UI, a relationship field is rendered as a picker over the related object’s instances, using its label_column for display (or the key value when it has none).
Relationship fields used to store the related instance key (
_key). They now store the primary key value, and existing values were converted.Source fields (backed objects)
On a backed object, a field withsource_column reads that column of the source. A field without it is a custom property, stored by Datazone and editable.
db_typeis required and must equal the column’s ClickHouse type.typeandoptionalare derived from it (Nullable(Int64)→ optionalint); a type with no field type, such asArray(String), becomesother.- Source fields are always read-only (
mutableis forced tofalse) and cannot setdefaultordb_column. - Each
source_columncan be used once. Primary key fields must be source fields, and cannot beother. - Custom properties must be
optionalor have adefault. source_columnis only allowed on backed objects.
Options
Astr field can declare a fixed set of allowed values with options. The UI renders it as a dropdown instead of a free-text input, and the API rejects any create/update whose value is outside the list.
optionsis only valid onstrfields, and must not be empty.- Writing an instance with a value not in
optionsreturns400.
settings
Object-level settings. All are optional.
label_columnmust name one of the object’s fields. It is used wherever an instance is shown by name — most importantly in relationship pickers.iconis purely for UI presentation.store_versionskeeps superseded versions of an instance available in history. It is on by default. With it off, old versions may be compacted away over time (history becomes best-effort). On a backed object, it keeps the edits of custom properties.sourcepoints a backed object at a dataset or view of the same project. It cannot be changed after the object is created, and neither canobject_type.
actions
Actions bind a named operation on the object to a Python handler function in your repository.
handler must point at a Python file and function in your repository. Changing an object’s actions does not trigger a schema migration — only field and setting changes do.
Executing actions via the API is on the roadmap; today, actions are declared and validated as part of the object definition.
Full example
objects/employee.yaml
Deploying multiple objects
To define more than one object in a single file, separate documents with---:
objects/hr.yaml
Next steps
- Overview — concepts, branching, and the lifecycle.
- Instance API — managing instances of your objects.