Enkinex ODCS Tutorial
Experience the power of writing your data contracts as code. This tutorial guides you through transforming the official ODCS YAML example into a robust, typed solution, leveraging modular KCL to streamline development with reusable components and eliminate repetitive tasks.
Introduction
This tutorial is a hands-on porting of the main ODCS full example into a modular code project. It walks through
Installing KCL
Enkinex ODCS is a KCL library, so the only prerequisite is the KCL command-line tool. It can be installed several ways depending on your platform: installation scripts for macOS, Linux, and Windows; package managers such as Homebrew, Scoop, Nix, or go install; a container image via Docker; or a binary release added to your PATH.
Project Module
The source we are porting
Contract Metadata
Everything under contract/ describes the contract itself — who defines it, what it is for, what it costs, the service levels it promises, and how to get support. Each file imports a schema from the library and fills it in as a named value the root can reuse.
Roles & Teams
The iam/ directory covers who may touch the data and who owns it. It maps to two schemas from the library's iam module: Role, for access levels and their approval chains, and TeamMember, for the people accountable for the contract.
Servers
The server/ group records where the data physically lives. The library ships a general Server schema plus more than thirty typed subschemas of it (postgres, bigquery, snowflake, kafka, s3, and the rest), one per documented type value. For this contract we need a single Postgres server, declared in server/postgres.k using the PostgresServer subschema:
Catalog
This is the piece the contract exists to govern: the dataset schema. We declare the tables and their columns under catalog/, then fold them into odcs.k to complete the contract.
Validating & Exporting
Parse and export