Set a domain on a column
Configure a fixed, hierarchical, or reference domain with set_column_domain.
set_column_domain configures one of three domain types
on a column. Pick the one that fits.
Fixed (enum)
A finite list of allowed values:
set_column_domain(table, "status", "fixed", values=["active", "inactive", "draft"])CLI: eddytor set domain … --type fixed, with values managed via eddytor set domain-values / eddytor create domain-value.
Hierarchical (parent → child)
A child column whose allowed values depend on a parent column's value. Set the parent's domain first, then key the hierarchy by the parent values' UUIDs (not the strings):
# 1. read the parent domain's value IDs
get_allowed_values(table, "category")
# -> [{ "id": "a1b2c3d4-…", "value": "Electronics" },
# { "id": "c3d4e5f6-…", "value": "Clothing" }, …]
# 2. key the hierarchy by those UUIDs
set_column_domain(table, "subcategory", "hierarchical",
parent_column="category",
hierarchy={ "a1b2c3d4-…": ["Phones", "Laptops"],
"c3d4e5f6-…": ["Shirts", "Pants"] })Heads up
hierarchy keys are parent-value UUIDs, not strings -
a string key fails with Invalid hierarchy format. Read them with
get_allowed_values(table, parent_column)
first. The hierarchy parameter replaces the entire mapping - include all
parent→child pairs, not just new ones.Chain deeper levels the same way (subcategory → product_type): read the subcategory value IDs, then map them.
Reference (cross-table)
Link a column to another table's domain - referential integrity across tables:
set_column_domain(table, "customer_id", "reference",
source_table="eddytor.cfg_xxx.<uuid>_customers", source_column="customer_id")The source column must already have a domain configured. Reference domains
validate live, so deleting a source value can orphan dependents - find them
with validate_domain_values.
Order & gotchas
- Set parent before child for hierarchies.
- Domain values are case-sensitive.
- Set domains before loading data.