Skip to main content

Backed Objects

A backed object reads its instances from a dataset or view you already have. Every row of the source is an instance. You pick the columns to expose, choose the primary key, and link the object to other objects. You can also add custom properties: editable fields that Datazone stores for each instance, next to the source data. Use a backed object when the data already lives in Datazone, for example customers loaded by an Extract or orders built by a Pipeline, and you want to:
  • give it a business name and a schema that other objects can reference,
  • link it to other objects through relationships,
  • let users or agents add notes, statuses, or tags to rows that come from somewhere else.

Create a backed object in the UI

Open Knowledge Objects in your project and click Create.
1

Source

Choose Backed, then pick a Dataset or a View of the project.
Choosing Backed and a source dataset on the create form
You need read access to the source. Only datasets and views of the same project are listed.
2

Details

Give the object a name, a description, and the branch to deploy on.
3

Schema

The form lists every column of the source with its exact ClickHouse type.
  • Untick a column to leave it out of the object.
  • Rename a field in the text box. The source column keeps its name.
  • Click the key icon to make a column part of the primary key.
  • Click the tag icon to make a column the label column.
  • Click the link icon to point the column at another object’s primary key. See Relationships.
Under Custom properties, add the editable fields you want to keep for each instance.
Schema step of a backed object with source columns, relationships and custom properties
Click Create. Datazone checks the source (see Source validation), writes the YAML file to your repository, and deploys it. The object is ready when its migration completes.

Source fields and custom properties

A backed object has two kinds of fields. Source fields read a column of the source. They have a source_column and are always read-only. Their type comes from the column’s ClickHouse type, which you set in db_type:
  • A Nullable(...) column becomes an optional field. LowCardinality(...) is unwrapped.
  • An other field is shown as is. It cannot be a primary key, have options, or hold a relationship.
  • Source fields cannot have a default or a db_column.
  • The primary key must be made of source fields.
Custom properties are fields without a source_column. They are stored by Datazone for each instance and are the only fields you can edit. Each custom property must be optional or have a default, because rows arrive from the source without a value. Until a row is edited, its custom properties are NULL (or their default).

Define it in YAML

objects/invoice.yaml
  • settings.source.type is dataset or view. settings.source.id is the id of the dataset or view.
  • Setting source is enough. object_type becomes BACKED on its own.
  • For source fields, leave out type and optional. They are derived from db_type.
  • db_type must match the source column’s type exactly, for example Nullable(Int64), not Int64.
See the YAML Reference for every attribute.

Relationships

A relationship field holds the primary key value of an instance of another object. CustomerID on Invoice holds a Customer’s CustomerID, so a source column that already contains the id is a relationship as is. No extra mapping is needed. In the Schema step, click the link icon on a source column. The picker lists the primary key fields of every object in the project, with their types:
Linking a source column to another object's primary key
To add a relationship that is not in the source, click Add relationship under Custom properties and pick an object. Datazone adds one custom property for each primary key field of that object, already linked. For an object with a composite key, it adds one field per key field, and together they form one link.
Add relationship lists the objects of the project and their primary keys
Relationship rules:
  • The field type must be str, int, or date. A str field can hold any key type. Other types must match the related key’s type.
  • If the related object has one primary key field, relationship only needs object.
  • If it has a composite key, each field sets relationship.field to the key field it holds. Each key field must be covered once.
  • When you create or edit an instance, Datazone checks that the value matches an existing instance of the related object. A composite link must be set completely or left empty.
Relationships hold primary key values for standalone objects too. Objects created before this change stored the related instance key (_key). Those values were converted to primary key values.

Edit instances

Open the object’s Instances tab and choose Edit on a row. Source fields are shown read-only. Custom properties can be changed. A custom relationship field opens a picker over the related object’s instances.
Editing a backed instance: source fields are read-only, custom properties are editable
The picker lists the related object’s instances by their label column, or by their key value when the object has no label column. Pick one to set the field to that instance’s primary key value.
Picking a related Orders instance for a relationship field
Backed rows cannot be created or deleted. They come and go with the source. There is no Add instances action and no Delete row action for backed objects. The Overview tab shows each field’s type, source column, and relationship, and the object’s source in the Meta panel.
Overview of a backed object with source columns and relationships

Keeping data fresh

  • Dataset sources are copied into a table that belongs to the object. Each time the dataset gets a new transaction (an Extract or Pipeline run), the copy is refreshed. The object keeps serving the previous rows until the refresh completes.
  • View sources are read live through the view.
  • Custom properties stay attached to their row across refreshes. The instance key is computed from the primary key values, so a row with the same key keeps its custom values. This holds even if the source column changes from Int32 to Int64 or becomes Nullable.
  • Renaming the source dataset or view re-runs the object’s migration, so it follows the new name.

Source validation

Datazone validates the source when you create the object, on every deploy, and on every migration:
  • every source_column exists in the source,
  • every db_type equals the column’s ClickHouse type,
  • the primary key has no NULL values,
  • the primary key is unique across the source rows.
If validation fails at creation, the request returns 400 with the reason, for example Primary key is not unique in the source: 1200 rows but 1000 distinct keys. If the source changes later and no longer passes, the object moves to ERROR. Fix the source, then click Retry next to the object’s status (or call retry-migration).

History

With store_versions on (the default), every edit to an instance’s custom properties is kept. The history endpoint returns those edits, newest first. Each entry holds the custom properties as they were at that edit. Source fields are not versioned, so every entry shows what the source holds now. An instance that was never edited has no history.

What you cannot change

These changes fail the deploy. Create a new object instead.
  • the object type (local ↔ backed),
  • the source (settings.source),
  • the primary key.

Next steps

  • YAML Reference — source, source_column, and relationship attributes.
  • Instance API — read and update backed instances, list source columns, retry a migration.