This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is the DuckDB CronJob Extension - a DuckDB extension that adds support for scheduled query execution using standard cron expressions. The extension runs as a background scheduler thread while the DuckDB process is active.
# Build release version
GEN=ninja make release
# Build debug version
GEN=ninja make debug
# Run tests (requires release build)
make test
# Run tests with debug build
make test_debug
# Format code
make format
It is best to build with a debug build for testing as it adds more assertions.
All extension functions should be documented inside of DuckDB with CreateScalarFunctionInfo or CreateAggregateFunctionInfo or the appropriate type for the function. This documentation of the function should include examples, parameter types and parameter names. The function should be categorized.
When making changes the version should always be updated to the current date plus an ordinal counter in the form of YYYYMMDDCC.
Tests use DuckDB's SQLLogicTest format located in test/sql/. To run a single test, build the extension and run the test binary directly:
./build/release/test/unittest "test/sql/cronjob.test"src/cronjob_extension.cpp- Main extension implementation containing:CronTask- Struct representing a scheduled job with ID, query, schedule, and execution historyCronScheduler- Singleton scheduler class that manages a background thread for job execution- SQL functions:
cron(),cron_delete(),cron_jobs()table function
ccronexpr/- C library for parsing cron expressions (vendored)duckdb/- DuckDB source as git submoduleextension-ci-tools/- DuckDB extension build tools as git submodule- OpenSSL - Required for build (linked via CMake)
The extension uses six-field cron expressions: second minute hour day-of-month month day-of-week
See docs/UPDATING.md for the full process. Key steps:
- Update
./duckdbsubmodule to latest tagged release - Update
./extension-ci-toolsto matching version branch - Update
duckdb_versionin.github/workflows/MainDistributionPipeline.yml