Example notebook
A full end-to-end notebook is available per environment (check your environment's configuration directory).
The notebook typically covers:
- Setup – Installation from PyPI, credentials (TOML or manual).
- Verify – Import and embedded function files (
_get_embedded_function_files()). - Client – Load client from TOML and set timeout; prepare
function_secretsfor deployment. - Optional cleanup – Delete container, functions, triggers/workflows (for a clean redeploy).
- Run validation –
run_validation()with TTL rules,DataModelConfig,instance_space,RecordsConfig,limit,print_output,post_to_records. - Records API – List streams; filter records (e.g. failed validations, Violation/Warning in last hour).
- Deploy infrastructure –
deploy_validation_infrastructure(settings_path, views_dir, function_secrets). - Deploy validation pipeline –
deploy_validation_pipeline(client, settings_path, view_external_id, wait=True)and display orchestration ID, partitions, sync trigger, monitor schedule.
Minimal script example
from cognite_data_quality import load_cognite_client_from_toml, run_validation, DataModelConfig, RecordsConfig
client = load_cognite_client_from_toml("config.toml")
result = run_validation(
client=client,
rules_path="shacl_rules/my_view_shacl.ttl",
rules_format="ttl",
datamodel=DataModelConfig(space="my_space", external_id="MyDataModel", version="v1"),
instance_space="my_instances",
records_config=RecordsConfig(
stream_id="dq_validation_stream",
rule_set_id="MyViewSHACLv1",
rule_set_version="1.0",
),
limit=10,
post_to_records=False,
)
print(result.conforms, result.instance_count, len(result.violations))
For YAML-based config (datamodel and instance space from the file):