Schema Plugins
Extend the schema workflow with row model generation, imports from a live database, and SQL backfills. Install TypeScript plugins as npm packages; plugins for the beta Python implementation ship inside chkit-py. The backfill plugin is in beta. Register plugins in the schema configuration:
import { defineConfig } from '@chkit/core'import { codegen } from '@chkit/plugin-codegen'import { pull } from '@chkit/plugin-pull'
export default defineConfig({ schema: './src/db/schema/**/*.ts', outDir: './chkit', plugins: [ codegen({ outFile: './src/generated/chkit-types.ts' }), pull({ outFile: './src/db/schema/pulled.ts' }), ], // ...})from chkit import define_configfrom chkit_plugin_codegen import codegen
config = define_config( { "schema": "./src/db/schema/**/*.py", "outDir": "./chkit", "plugins": [ codegen({"outFile": "./src/generated/chkit_models.py"}), ], # ... })In Python, pull is a built-in CLI command (chkit pull) rather than a registered plugin.
How plugins hook in
Section titled “How plugins hook in”Plugin authors use lifecycle hooks to transform schema definitions before a diff, register CLI commands, run setup (onInit) or teardown (onComplete), and transform SQL before migration (onBeforeApply). The CLI: chkit plugin command lists plugins active in your config.
Follow the plugin reference to configure a published plugin. Use the lifecycle hooks when writing a plugin.
You can author your own plugins; the existing official plugins are the reference. See Contributing for the entry point.
Schema workflow plugins
Section titled “Schema workflow plugins”For @chkit/plugin-obsessiondb (Python: chkit_plugin_obsessiondb), see the ObsessionDB section.
@chkit/plugin-codegen: TypeScript row types and optional Zod schemas (Python: Pydantic models), generated from your schema files.@chkit/plugin-pull: introspect a live ClickHouse database into local schema files. Useful for adopting chkit on an existing database. Built into the Python CLI aschkit pull.@chkit/plugin-tinybird: translate a Tinybird project into chkit tables, materialized views, refreshable materialized views and typed queries, reporting what does not translate.@chkit/plugin-backfill(beta): partition/sort-key data backfill with checkpoints, for materialized views and historical data loads.
Related pages
Section titled “Related pages”- Configuration — register plugins alongside schema and connection settings
chkit plugin— inspect and run configured plugin commands- Migration workflow — generate, review, and deploy schema changes