pond.toml
Every Pond project has a pond.toml at its root, declaring what the Pond is and what it depends on. It's read when the Pond is deployed and on every local run. Environment-specific settings, such as Refreshes, windows, Spouts, secrets and alerts, are configured on the Catchment instead and don't appear here.
[pond]
name = "sales"
version = "1.2.0"
type = "pond"
immediate_retries = 1
source_retries = 2
[sources]
transactions = "1.0.0"
products = "1.1.0"
[pond]
| Key | Type | Default | Description |
|---|---|---|---|
name | string | required | The Pond's name, unique within a Catchment. |
version | string | required | A semantic version, MAJOR.MINOR.PATCH. The major version decides which line a deployment joins: the same major upgrades the running line, a new major deploys alongside it. See Versioning. |
type | string | "pond" | "inlet", "pond" or "outlet". Descriptive: it records the Pond's intended role and is shown in the UI, but doesn't change how it runs. "app" is different: it makes the Pond an App. |
ripples | string | "src/pond.py" | Path to the module defining the Python Ripples. Optional when the Pond has only SQL Ripples. |
puddles | string | "src/puddles.py" | Path to the module defining the Puddles. |
immediate_retries | integer | 1 | How many times a failed Ripple is retried within the same Pond Run. |
source_retries | integer | 0 | How many times a failed Pond Run is retried when a Source next updates. |
memory | string | The memory the Pond's Runs need, DuckDB and Python together, such as "6GB". It applies to every Ripple (SQL Ripples and dbt models included) unless a Python Ripple sets its own with @ripple(memory=...). See @ripple. For an App, the memory it sets aside while it runs, DuckDB included. | |
duck | string | "catchment" | Where the Pond runs: "catchment" for the Catchment's own machine, a built-in pool ("S", "M", "L", "XL"), or the name of a pool defined on the Catchment. Falls back to the Catchment's machine when cloud compute isn't configured or the pool doesn't exist. See duckstring duck. |
external | list of strings | Where the Pond's data comes from outside the pipeline, drawn on the canvas as dotted nodes feeding it, such as ["GDELT events"]. "app:{name}@{major}" names an App line's Records and Media and opens them when clicked. For the picture only: it changes nothing about how the Pond runs. | |
dbt_project | string | Path to a dbt project directory. Makes this a dbt Pond: each model becomes a Ripple, and the Pond can't also define @ripple functions, SQL Ripples or static tables. Needs the duckstring[dbt] extra. |
The two retry budgets set the starting values when a Pond is first deployed. After that the Catchment's values are authoritative, and are changed with duckstring control failure-budget.
[sources]
Each key is a Source Pond's name, and each value pins it:
[sources]
transactions = "1.2.0" # major version 1, at least 1.2.0
products = "2.0.0?" # optional: major version 2, at least 2.0.0
| Value | Meaning |
|---|---|
"MAJOR.MINOR.PATCH" | A required Source. The Pond reads that major line, and the deployed version must be at least this one. The Pond waits for the Source before running, and its freshness is the oldest of its required Sources. |
"MAJOR.MINOR.PATCH?" | An optional Source. The Pond uses whatever the Source has published but never waits for it. A Pond with only optional Sources takes the freshness of the freshest. A Refresh builds an optional Source once and doesn't refresh it after that (unless all the Pond's Sources are optional). |
Deployment enforces the pins in both directions: a Pond can't be deployed against a Source older than its minimum, and a Source can't be redeployed below a version that a deployed Pond requires. Both are rejected with an error.
A Source doesn't need to be deployed first. A Pond whose Source is missing is held until it arrives.
[ripples]
Declares SQL Ripples, one table per Ripple. They can be mixed with the Python Ripples in the ripples module.
[ripples.sale_line]
sql = "sql/sale_line.sql"
parents = ["daily_sales", "price_tiers"]
reads = ["products.product"]
write = "merge"
pk = ["sale_date", "product_id"]
The entry's name (sale_line) is the Ripple's name and the name of the table it writes. Names are letters, digits and underscores, and are shared with Python Ripples and static tables, so each must be unique.
| Key | Type | Default | Description |
|---|---|---|---|
sql | string | required | Path, relative to the Pond's directory, of a file holding one SELECT. |
parents | list of strings | [] | Ripples in this Pond, SQL or Python, that must finish before this one starts. |
reads | list of strings | [] | Tables of other Ponds the query reads, as source.table, each from a Source in [sources]. The query refers to them by the same name. |
write | string | "overwrite" | "overwrite" replaces the table each run, "merge" records changes to a table whose query returns its complete current state, and "append" adds each run's rows to its history. See Append and Merge Tables. |
pk | string or list | Primary key columns. Required for "merge", optional for "append", not allowed for "overwrite". | |
always_run | boolean | false | Run even when no Source has changed since the last Pond Run, as @ripple(always_run=True). |
cluster_by, interleave, cluster_bits | With write = "overwrite" or "merge": how the table is ordered for reads that filter on those columns, as for write_table and merge_table. |
Each query may only read tables its declaration accounts for: an ancestor's table, an entry in reads, a static table, or its own previous output. A query reading anything else, an unknown parent, a cycle, or a missing file rejects the deployment and stops a local run, with a message naming the Ripple.
[static]
Declares files shipped with the Pond's code as read-only tables, visible to every Ripple under the table's name.
[static.tier_bands]
path = "data/tier_bands.csv"
| Key | Type | Description |
|---|---|---|
path | string | Path relative to the Pond's directory. CSV (.csv, .tsv), Parquet (.parquet) or JSON (.json, .jsonl, .ndjson), chosen by the extension. |
Static tables aren't published. A changed file takes effect from the first run after it's redeployed, and doesn't start a run by itself. The file must be included in the deployment, so check .pondignore doesn't exclude it.
[flock]
Allows over-sized computations to be sent to a larger engine. See Offloading Large Recomputes.
| Key | Type | Default | Description |
|---|---|---|---|
mode | string | "off" | "off": never send work out. "upgrade": send a full recompute out only when it is clearly too large for the Duck, or after it runs out of memory locally. "always": send every eligible full recompute out. |
engine | string | the first configured | The engine to use: motherduck, motherduck/<profile>, starrocks, athena, or module:Class for a custom engine. Without one, the first configured engine in that order. |
oom_policy | string | "fail_up" | "fail_up": when a local recompute runs out of memory, retry it on the engine. "fail": let it fail. |
accept | list of strings | [] | Known differences to accept from an engine that isn't DuckDB: "float_order", "half_rounding". See Accepting known differences. |
The defaults come from the Catchment (DUCKSTRING_FLOCK_MODE, DUCKSTRING_FLOCK_ENGINE, DUCKSTRING_FLOCK_OOM_POLICY, DUCKSTRING_FLOCK_ACCEPT) when the key is omitted. The Flock only takes effect when an engine is configured on the Catchment. Otherwise everything runs in the Duck. Operators can override these per Pond with duckstring duck set.
Python dependencies
A Pond's Python packages aren't declared in pond.toml, but in a standard pyproject.toml beside it, locked into a uv.lock:
# pyproject.toml
[project]
name = "sales"
version = "1.2.0"
requires-python = ">=3.10"
dependencies = ["duckstring", "scikit-learn>=1.5"]
| Files present | Environment |
|---|---|
| Neither | The Catchment's own Python environment. |
pyproject.toml and uv.lock | The Pond's own, built by the Catchment from uv.lock on deploy. |
pyproject.toml only | Deploy is refused: run uv lock. |
The Catchment builds the environment with uv sync --locked, so a uv.lock that no longer matches pyproject.toml is also refused. Dev dependencies are left out. The Catchment then installs its own version of Duckstring into the environment, with its own version of the Trickle engine (duckstring-trickle), replacing any versions in the lock, since the Duck and the Catchment must match. The environment uses the Catchment's Python version, unless the Pond has a .python-version file.
Lock against a released Duckstring. A lock made against a local checkout (uv add --editable ../duckstring) names a path that exists only on your machine, so a Catchment elsewhere refuses it.
Environments are stored under the Catchment's state directory in envs/, one per distinct lock, and shared by every Pond with the same one. A Duck on a pool or in the cloud builds the environment on its own machine when it starts, from the lock the Catchment checked, with that machine's Python and Duckstring. A pool machine keeps it for later Ducks; a cloud Duck builds it again on each cold start.
requirements.txt isn't read. It has no lock, so the deployed environment could differ from the one the Pond was tested in.
[serve]
| Key | Type | Default | Description |
|---|---|---|---|
tables | list of strings | [] | Tables exposed to users with read-only access when querying the catalog. Users with full access see every table. Can be overridden on the Catchment with duckstring data expose. |
[app]
With type = "app", the Pond is an App: an Outlet that serves HTTP instead of running Ripples. It declares its Sources in [sources] like any Pond, so a Refresh on it reaches every Source it reads, and it can't be a Source itself. It has no Ripples, SQL Ripples, static tables or dbt project.
[pond]
name = "sales_dashboard"
version = "1.0.0"
type = "app"
[sources]
reports = "1.2.0"
[app]
command = 'uvicorn main:app --port $PORT --root-path "$DUCKSTRING_APP_PATH"'
health = "/healthz"
The Catchment serves the App at /apps/{name}/v{major}/ on its own port, and /apps/{name}/ redirects to the major pond promote last chose (the first deployed until then), which for an App with Records or Media is its live major. The first request starts an instance of the App and waits until it's ready. Requests need the same access as the Catchment's API: none on an open Catchment, otherwise a read-level key, which a browser enters once on a sign-in page. The key is removed before the request reaches the App.
| Key | Type | Default | Description |
|---|---|---|---|
command | string | The command that serves the App, run with /bin/sh in the App's directory, with its Python environment's bin first on PATH. It must listen on 127.0.0.1:$PORT. | |
static | string | A directory of files the Catchment serves itself, such as a built frontend. A request for a file in it never reaches the process. An App needs command, static or both. | |
strip_path | boolean | true | Whether requests reach the App with its base path removed, the convention uvicorn --root-path and WSGI servers expect. The base path is sent as X-Forwarded-Prefix either way. Set false for frameworks configured with the full path, such as Streamlit's server.baseUrlPath. |
health | string | A path, below the base path, that answers 2xx once the App is ready. Without it, the App is ready once its port accepts connections. | |
idle_timeout | string | "30m" | How long without a request before the process stops, such as "10m" or "1h". The next request starts it again. "0" keeps it running. |
state | string | "local" | "local" gives the App a directory on the Catchment's machine that survives restarts and redeploys, at $DUCKSTRING_APP_STATE. "none" gives it none, and is needed for more than one instance or for instances on other compute. |
download | string | A command that writes the App's state for catchment download and the state backup. Without it, the App's state isn't included in either. Not allowed with state = "none". | |
records | boolean | false | Give each major line of the App its own Records: a PostgreSQL schema and role named {name}_v{major}. Needs a name of lower-case letters, digits and underscores, starting with a letter or underscore, of at most 48 characters. |
media | boolean | false | Give each major line of the App its own Media: a folder of files, on the Catchment's disk or in an object store. |
migrate | string | A command that brings a new major line's copy of the previous line's Records and Media up to date. Only with records or media. See New major versions. | |
instances | integer | 1 | The most instances the App runs at once, from 1 to 64. More than one needs state = "none". See Scaling Apps. |
min_instances | integer | 0 | Instances kept running with no requests, at most instances. On an App with its own compute ([pond] duck), 1 or more keeps it off the Catchment's machine. |
concurrency | integer | 4 | The requests and active WebSockets one instance takes at once. Routing and scaling are measured against it. |
connections | integer | concurrency | The PostgreSQL connections one instance may hold to its Records. |
stop_grace | string | "10s" | How long a stopping instance has to exit after SIGTERM before it's killed. |
The process gets these environment variables:
| Variable | Value |
|---|---|
PORT | The port to listen on. |
DUCKSTRING_APP_PATH | The base path, such as /apps/sales_dashboard/v1. |
DUCKSTRING_APP_STATE | The state directory, with state = "local". |
DUCKSTRING_APP | What duckstring.app.pond() reads to give the App a read-only handle on its Sources. |
DUCKSTRING_RECORDS_URL | With records, a PostgreSQL connection URL signing in as the line's role. |
DUCKSTRING_MEDIA_URL | With media, where the line's Media is: a local directory or an object-store URI. |
DUCKSTRING_APP_INSTANCE | The instance's number. |
DUCKSTRING_APP_CONCURRENCY | The App's concurrency. |
DUCKSTRING_APP_CONNECTIONS | The App's connections, which records_pool() sizes its pool to. |
The migrate command gets the same Records and Media variables for the new line, and DUCKSTRING_PREVIOUS_MAJOR (the line its data was copied from), DUCKSTRING_PREVIOUS_MEDIA_URL (that line's Media, with media) and DUCKSTRING_PREVIOUS_STATE (that line's state directory, when it has one). It runs in the App's directory and environment, and fails after 10 minutes.
[app.scale]
The thresholds the Catchment grows an App by. When one of them is reached on average across the ready instances over the last after, another instance starts, up to instances. See Scaling Apps.
| Key | Type | Default | Description |
|---|---|---|---|
requests | number | 0.7 | Active work per instance, as a share of concurrency. Active work is requests in flight plus WebSockets that carried a message within socket_idle. |
cpu | number | 0.7 | CPU use, as a share of the instance's cores. |
memory | number | 0.8 | Memory use, as a share of the instance's limit. |
load | number | 0.7 | The load the App reports itself, with report_load() or an X-Duckstring-Load response header. |
after | string | "10s" | The window a threshold is averaged over before another instance starts. Each further instance waits its own after. |
socket_idle | string | "5s" | How recently a WebSocket must have carried a message to count as active. |
Shares are above 0 and at most 1.
While an instance runs on the Catchment's machine, it sets [pond] memory aside there, and the memory slots that Pond Runs share divide what's left of the budget. Set it to what the whole App needs, DuckDB included; the App's handle limits DuckDB to that amount. An App that doesn't set it sets nothing aside, and its DuckDB is limited to 256 MB. Running Apps may set aside at most half the budget, and a start that would go past that gets a 503. The memory comes back when the instance stops. An instance on other compute uses that machine's memory. DuckDB's limit applies in each process, so in a server with several worker processes, each worker's DuckDB may use that much.
catchment download and the state backup never copy an App's files as they are. Only the App knows which of its files matter and how to copy them consistently while it runs, so they include its state only through download. The command runs in the App's directory and environment with $DUCKSTRING_APP_STATE set, whether or not the App is running, and writes into $DUCKSTRING_APP_DOWNLOAD exactly what the state directory should hold after a restore: a consistent copy of a database, say, leaving out anything secret. If it fails or takes longer than 10 minutes, the download fails with its output, and a state backup goes ahead without that App's state. The App's logs are never included.
A Source keeps the version an App is reading. Each request holds what each Source had published when it arrived, until its response has been sent, and a WebSocket connection holds what was published at its latest message from the browser (and at the one before, for a minute). Reads outside a request, such as a background thread or a cache filled at startup, hold theirs with with pond.hold():.
A Tap on an App sends it a Refresh on use: every request that reaches the process counts as a query.
A process that exits, or isn't ready within 60 seconds (DUCKSTRING_APP_START_TIMEOUT), is started again on the next request, up to immediate_retries times in a row. After that the App fails until it's woken with control wake or redeployed. duckstring app lists its instances and prints their output.
Nothing can depend on an App, so its version only matters for the major in its address: a new major runs beside the old one. For an App with Records or Media, a new major is a trial until pond promote makes it live (see New major versions). The running version can be redeployed as it is, without bumping it. Its process is stopped and the next request starts the new code.
duckstring pond run in an App's directory serves it at http://127.0.0.1:8000/ against its Puddles, with an empty base path. Records are kept in a PostgreSQL of the App's own under puddles/app/records/ and Media under puddles/app/media/.