Skip to main content

DuckDB Extensions

flAPI reads Postgres, S3, DuckLake and friends through DuckDB extensions. Since v26.11.23 every release carries the extensions it needs by default, so a fresh host or container starts without downloading anything. This page covers:

  • which extensions ship, and where;
  • the order in which flAPI looks for them;
  • how to add more, and how to run with no network at all.

What ships​

ExtensionHow you get it
core_functions, parquet, json, icuBuilt into the flAPI binary (DuckDB 2.0). Never downloaded, installed or packed.
httpfs, ducklake, fts, postgres, sqliteSigned builds in extensions/<duckdb version>/<platform>/ next to the binary: in the release archives, and in the Docker images at /app/extensions.
bigqueryIn the :<tag>-runtime Docker image only (/app/extensions).
anything elseDownloaded on first use into ~/.duckdb/extensions, or pre-installed by you (below).

flAPI finds the shipped directory by its real executable path, with symlinks resolved, so /usr/local/bin/flapi -> /opt/flapi/flapi works. Keep the binary and its extensions/ directory together when you copy a release around.

The flapi-io PyPI wheels carry no extensions: with them a wheel would be about 155 MB, above PyPI's 100 MB file limit. A pip-installed flapi downloads them on first start, unless you point FLAPI_EXTENSION_DIRECTORY at a filled directory.

Which extensions load at startup​

duckdb.default-extensions lists the extensions flAPI loads at startup. The default is [httpfs, ducklake, fts, json, postgres, sqlite, parquet]; the built-in ones are skipped.

duckdb:
# Replaces the defaults: list them too if you still need them.
default-extensions: [httpfs, ducklake, fts, json, postgres, sqlite, parquet, bigquery]

[] loads none, and a scalar is refused. Startup LOADs each listed extension and INSTALLs (downloads) only one that no search directory has.

Under restricted external access (the default for a remote config), an extension a template uses must be loaded here or by a LOAD in a connection init: nothing can load after startup.

Where flAPI looks​

First match wins:

#SourceUsed as
1duckdb.extension_directory (or extension_directories) in flapi.yamlthe only directory
2FLAPI_EXTENSION_DIRECTORYthe only directory
3extensions embedded by flapi pack --with-extensionsthe only directory; offline on
4extensions/ next to the flapi executable (release archives, Docker /app/extensions)searched after the user directory below
5DuckDB's default, ~/.duckdb/extensionsinstall target, searched first
  • Sources 1-3 replace the shipped directory: point flAPI at a directory and you get exactly that directory, and a packed binary never loads a second copy of an extension.
  • The shipped directory is only ever read (it may be read-only). Anything else installs into ~/.duckdb/extensions, and a copy you install there on purpose (FORCE INSTALL httpfs, say a fix before the next flAPI release) wins over the shipped one.
  • A shipped directory for another DuckDB version (left over from an older release) is ignored with one warning.
  • macOS: a release archive downloaded with a browser is quarantined, and so is everything unpacked from it. Clear it once for the whole directory: xattr -dr com.apple.quarantine <unpacked dir>.

Pre-installing extensions: flapi extensions install​

# Everything a config needs: duckdb.default-extensions and every INSTALL in connections.*.init
flapi extensions install --config flapi.yaml --dir /opt/flapi/extensions

# Or name them; @repo for non-core repositories
flapi extensions install --dir /opt/flapi/extensions httpfs ducklake bigquery@community

# flAPI's default set (httpfs ducklake fts postgres sqlite): what a release ships
flapi extensions install --defaults --dir ./extensions

It installs into --dir (default: FLAPI_EXTENSION_DIRECTORY, then DuckDB's own default) and exits 1 if any extension failed, after reporting every failure. A release binary copies the extensions it ships into --dir instead of downloading them. The directory is keyed by DuckDB version and platform, so install with the same flapi binary you ship.

Run it at image build time, then at runtime:

export FLAPI_EXTENSION_DIRECTORY=/opt/flapi/extensions
export FLAPI_EXTENSIONS_OFFLINE=1 # a missing extension stops startup instead of downloading

FLAPI_EXTENSIONS_OFFLINE=1 (also true/yes) skips every INSTALL, turns autoinstall_known_extensions off and fails startup when a default extension cannot be loaded, naming it and flapi extensions install. Without it a missing extension is only a warning. Offline also works with the shipped directory alone.

One file, no network: flapi pack --with-extensions​

flapi pack --in ./my-api --out my-api-bin --with-extensions
scp my-api-bin user@host:/opt/flapi/

--with-extensions installs the extensions the config needs for the platform pack runs on and embeds them under .flapi/extensions/. At startup the binary extracts them once to $TMPDIR/flapi-extensions/ext-<content hash>/ and uses that as extension_directory with offline extensions on. Because a release binary copies its shipped extensions, this works offline too.

To pack for another platform, fill a directory with that platform's flapi extensions install and pass --extensions-dir <dir> instead. Set FLAPI_EXTENSIONS_OFFLINE=0 to let a packed binary download anyway. On macOS the extensions usually exceed the 16 MiB reserved bundle segment; see Server CLI.

Docker images​

ImageExtensions in /app/extensions
ghcr.io/datazoode/flapi:latest, :v<version>httpfs, ducklake, fts, postgres, sqlite
ghcr.io/datazoode/flapi:v<version>-runtimethe same, plus bigquery

Neither image sets FLAPI_EXTENSION_DIRECTORY. Since v26.11.25 the -runtime image build fails instead of silently leaving bigquery out (v26.11.23-runtime shipped without it). A derived image that installs extensions into /opt/flapi/extensions (the pre-v26.11.23 -runtime layout) must set FLAPI_EXTENSION_DIRECTORY=/opt/flapi/extensions itself, or install into /app/extensions.

Upgrading from a DuckDB 1.5-based flAPI​

  • The extension directory is per DuckDB version. Offline setups must re-populate FLAPI_EXTENSION_DIRECTORY for DuckDB 2.0.1 with flapi extensions install; core_functions, parquet, json and icu are no longer needed there.
  • New database files and DuckLake catalogs are 2.0-only (see Deployment).
🍪 Cookie Settings