← ClaudeAtlas

duckdb-sessionlisted

Attach native DuckDB database files and persist session state across CLI calls with a state.sql init file. Covers storage version detection, schema introspection, WAL checkpoints, locking, and safe detach. Use when attaching or opening a database, switching catalogs, or persisting state across commands.
srimon12/duckdb-2-skills · ★ 1 · Data & Documents · score 65
Install: claude install-skill srimon12/duckdb-2-skills
# Database sessions DuckDB CLI executions terminate after each command, discarding runtime `ATTACH` bindings. To persist attached databases across invocations, record attachment statements in an initialization script and pass `-init <path>` on startup. For execution binary rules, see `duckdb`. For SQLite databases, see `duckdb-files`. For DuckLake, Iceberg, and Delta catalogs, see `duckdb-lakehouse`. For Quack, Postgres, and MySQL connections, see `duckdb-quack`. Never store raw secrets in the state file. Record only `ATTACH` commands and `CREATE SECRET` statements referencing an external provider chain or pre-existing secret name. ## State file discovery Search for a state file in this exact sequence: 1. `.duckdb/state.sql` in the project root. 2. `.duckdb-skills/state.sql` in the project root (upstream duckdb-skills plugin convention). 3. `$HOME/.duckdb-skills/<project-id>/state.sql` (`<project-id>` replaces `/` with `-` in the absolute project root). If no state file exists: - When the project root is `$HOME`, create `$HOME/.duckdb-skills/state.sql` to avoid colliding with `~/.duckdb/`. - When session persistence belongs outside the repository, write to the `$HOME/.duckdb-skills/<project-id>/` location. - Otherwise, create `.duckdb/state.sql`, report the path to the user, and offer to add `.duckdb/` to `.gitignore`. ## State file reconciliation Treat the state file as append-only. Never overwrite or truncate it, as it may contain user macros, variables, and `LOAD`