ClickHouse + Bruin 101
1) Load the governed country target seed
assets/data_definitions/country_targets.asset.yml is a clickhouse.seed asset. It loads the nearby country_targets.csv file into ClickHouse as country_targets.
The opening of the asset declares what Bruin should load and who owns it:
# assets/data_definitions/country_targets.asset.yml
name: country_targets
type: clickhouse.seed
tags:
- layer:reference
- domain:commerce
domains:
- commerce
meta:
business_owner: [email protected]
change_management: pull-request
data_classification: internal
owner: [email protected]
type: clickhouse.seed tells Bruin that this asset is file-backed reference data, not a SQL query. name becomes the ClickHouse table name and the name that downstream models use in depends. The owner, domains, tags, and meta fields travel with the asset's lineage and catalog record.
The next chunk points at the file and defines its contract:
parameters:
enforce_schema: true
path: country_targets.csv
columns:
- name: country
type: String
primary_key: true
checks:
- name: not_null
- name: unique
- name: monthly_revenue_target
type: Float64
checks:
- name: positive
- name: is_priority_market
type: UInt8
checks:
- name: accepted_values
value: [0, 1]
path is relative to this YAML file, so the CSV stays versioned beside its definition. enforce_schema: true asks Bruin to validate the file before loading it. The three columns entries define ClickHouse types and quality checks: countries must be unique, targets must be positive, and the market flag may only be 0 or 1.
The YAML file is the contract and the CSV is the value set:
parameters.path: country_targets.csvkeeps the reference data versioned with the pipeline.enforce_schema: truemakes Bruin verify the CSV against the declared ClickHouse types before loading it.- The primary key and
not_null,unique,positive, andaccepted_valueschecks protect the country, revenue-target, and priority-market columns. owner,domains,tags, andmetaattach governance context to static data too. Thechange_management: pull-requestmetadata makes the expected review path explicit.
This is useful when a small business-owned lookup should be reviewed in Git, not maintained in an untracked spreadsheet. The seed asset reference has the full schema.