duckpack 0.2.2__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. {duckpack-0.2.2 → duckpack-0.3.0}/.github/workflows/release.yml +10 -2
  2. {duckpack-0.2.2 → duckpack-0.3.0}/Cargo.lock +1 -1
  3. {duckpack-0.2.2 → duckpack-0.3.0}/Cargo.toml +1 -1
  4. {duckpack-0.2.2 → duckpack-0.3.0}/PKG-INFO +76 -35
  5. {duckpack-0.2.2 → duckpack-0.3.0}/README.md +75 -34
  6. {duckpack-0.2.2 → duckpack-0.3.0}/pyproject.toml +1 -1
  7. {duckpack-0.2.2 → duckpack-0.3.0}/scripts/scaffold_demo_project.sh +1 -1
  8. {duckpack-0.2.2 → duckpack-0.3.0}/src/catalog.rs +280 -56
  9. {duckpack-0.2.2 → duckpack-0.3.0}/src/diff.rs +544 -11
  10. {duckpack-0.2.2 → duckpack-0.3.0}/src/engine.rs +1513 -36
  11. {duckpack-0.2.2 → duckpack-0.3.0}/src/ide/explorer.rs +134 -3
  12. {duckpack-0.2.2 → duckpack-0.3.0}/src/ide/mod.rs +221 -1748
  13. duckpack-0.3.0/src/ide/modals/attach.rs +2791 -0
  14. duckpack-0.3.0/src/ide/modals/dialogs.rs +508 -0
  15. duckpack-0.3.0/src/ide/modals/input.rs +96 -0
  16. duckpack-0.3.0/src/ide/modals/mod.rs +25 -0
  17. duckpack-0.3.0/src/ide/modals/project_modals.rs +680 -0
  18. duckpack-0.3.0/src/ide/modals/secrets.rs +930 -0
  19. duckpack-0.3.0/src/ide/modals/time_travel.rs +718 -0
  20. duckpack-0.3.0/src/ide/tests.rs +2219 -0
  21. {duckpack-0.2.2 → duckpack-0.3.0}/src/main.rs +223 -22
  22. {duckpack-0.2.2 → duckpack-0.3.0}/src/python.rs +7 -1
  23. {duckpack-0.2.2 → duckpack-0.3.0}/src/query.rs +19 -2
  24. {duckpack-0.2.2 → duckpack-0.3.0}/src/tui.rs +22 -8
  25. {duckpack-0.2.2 → duckpack-0.3.0}/tests/test_python_api.py +1 -1
  26. {duckpack-0.2.2 → duckpack-0.3.0}/tests/v2_compat_test.rs +11 -1
  27. duckpack-0.2.2/src/ide/modals.rs +0 -3737
  28. {duckpack-0.2.2 → duckpack-0.3.0}/.cargo/config.toml +0 -0
  29. {duckpack-0.2.2 → duckpack-0.3.0}/.gitignore +0 -0
  30. {duckpack-0.2.2 → duckpack-0.3.0}/LICENSE +0 -0
  31. {duckpack-0.2.2 → duckpack-0.3.0}/duckpack_logo.png +0 -0
  32. {duckpack-0.2.2 → duckpack-0.3.0}/python/duckpack/__init__.py +0 -0
  33. {duckpack-0.2.2 → duckpack-0.3.0}/python/duckpack/__main__.py +0 -0
  34. {duckpack-0.2.2 → duckpack-0.3.0}/python/duckpack/_duckpack.pyi +0 -0
  35. {duckpack-0.2.2 → duckpack-0.3.0}/python/duckpack/cli.py +0 -0
  36. {duckpack-0.2.2 → duckpack-0.3.0}/python/duckpack/notebook.py +0 -0
  37. {duckpack-0.2.2 → duckpack-0.3.0}/python/duckpack/py.typed +0 -0
  38. {duckpack-0.2.2 → duckpack-0.3.0}/python/duckpack/runner.py +0 -0
  39. {duckpack-0.2.2 → duckpack-0.3.0}/python/duckpack/terminal.py +0 -0
  40. {duckpack-0.2.2 → duckpack-0.3.0}/src/ide/editor.rs +0 -0
  41. {duckpack-0.2.2 → duckpack-0.3.0}/src/lib.rs +0 -0
  42. {duckpack-0.2.2 → duckpack-0.3.0}/src/syntax.rs +0 -0
@@ -4,6 +4,8 @@ on:
4
4
  push:
5
5
  tags:
6
6
  - "v*.*.*"
7
+ release:
8
+ types: [published]
7
9
  workflow_dispatch:
8
10
 
9
11
  jobs:
@@ -87,10 +89,15 @@ jobs:
87
89
  fail-fast: false
88
90
  matrix:
89
91
  include:
90
- - os: ubuntu-latest
92
+ - os: ubuntu-22.04
91
93
  target: x86_64-unknown-linux-gnu
94
+ manylinux: "2_28"
92
95
  - os: ubuntu-24.04-arm
93
96
  target: aarch64-unknown-linux-gnu
97
+ manylinux: "2_28"
98
+ - os: ubuntu-22.04
99
+ target: x86_64-unknown-linux-musl
100
+ manylinux: "musllinux_1_2"
94
101
  - os: macos-latest
95
102
  target: aarch64-apple-darwin
96
103
  deployment_target: "10.15"
@@ -107,7 +114,8 @@ jobs:
107
114
  uses: PyO3/maturin-action@v1
108
115
  with:
109
116
  target: ${{ matrix.target }}
110
- args: --release --out dist
117
+ manylinux: ${{ matrix.manylinux || 'auto' }}
118
+ args: --release --out dist --strip
111
119
  env:
112
120
  MACOSX_DEPLOYMENT_TARGET: ${{ matrix.deployment_target || '' }}
113
121
 
@@ -638,7 +638,7 @@ dependencies = [
638
638
 
639
639
  [[package]]
640
640
  name = "duckpack"
641
- version = "0.2.2"
641
+ version = "0.3.0"
642
642
  dependencies = [
643
643
  "anyhow",
644
644
  "arboard",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "duckpack"
3
- version = "0.2.2"
3
+ version = "0.3.0"
4
4
  edition = "2024"
5
5
  readme = "README.md"
6
6
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: duckpack
3
- Version: 0.2.2
3
+ Version: 0.3.0
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: 3
@@ -19,7 +19,7 @@ Requires-Python: >=3.10
19
19
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
20
20
 
21
21
  <p align="center">
22
- <img src="duckpack_logo.png" width="400" alt="DuckPack Logo" />
22
+ <img src="https://raw.githubusercontent.com/Benjas86/duckpack/main/duckpack_logo.png" width="400" alt="DuckPack Logo" />
23
23
  </p>
24
24
 
25
25
  <p align="center">
@@ -81,7 +81,7 @@ DuckPack includes a **rich terminal IDE** for live database exploration and firs
81
81
  - [Directory Layout](#directory-layout)
82
82
  - [Configuration (`duckpack.toml`)](#configuration-duckpacktoml)
83
83
  - [Environment Variables (`.env`)](#environment-variables-env)
84
- - [Ignoring Tables (`.duckdbignore`)](#ignoring-tables-duckdbignore)
84
+ - [Ignoring Assets & Scripts (`.duckpackignore`)](#ignoring-assets--scripts-duckpackignore)
85
85
  - [📦 DuckPacks (`.duckpack`) for CI/CD](#-duckpacks-duckpack-for-cicd)
86
86
  - [NOTE](#note)
87
87
 
@@ -89,19 +89,20 @@ DuckPack includes a **rich terminal IDE** for live database exploration and firs
89
89
 
90
90
  ## ✨ Features
91
91
 
92
- - **Declarative Schema Management ("SSDT for DuckDB"):** Define your schemas, tables, views, and macros as raw `.sql` files. No migration timestamps, sequence numbers, or rollback scripts to maintain.
92
+ - **Declarative Schema Management ("SSDT for DuckDB"):** Define your schemas, sequences, tables, views, and macros as raw `.sql` files. No migration timestamps, sequence numbers, or rollback scripts to maintain.
93
+ - **First-Class Sequences & Dependency-Safe Compilation:** Native support for DuckDB `sequences/` compiled in topological order (`schemas` $\rightarrow$ `types` $\rightarrow$ `sequences` $\rightarrow$ `macros` $\rightarrow$ `tables` $\rightarrow$ `views` $\rightarrow$ `triggers`), ensuring tables with surrogate keys (`DEFAULT nextval('...')`) compile and apply seamlessly.
93
94
  - **Table Constraint Diffing & Copy-and-Swap Migrations:** Automatically introspects `PRIMARY KEY`, `UNIQUE`, `FOREIGN KEY`, and `CHECK` constraints. Generates in-place `ALTER TABLE` statements for safe additions and transactional copy-and-swap (`__duckpack_swap`) staging tables for complex constraint modifications.
94
95
  - **Catalog-Aware Multi-Database Targeting:** Seamlessly target specific attached databases (via `--database <name>`, `duckpack.toml [target] database = "..."`, or Python `duckpack.apply(con, database="analytics")`) with strict catalog isolation.
95
- - **Clear Engine Boundary (SSDT vs Federation):** Full declarative DDL lifecycle management specifically engineered for DuckDB, Quack, and MotherDuck. External attached engines (MSSQL, PostgreSQL, MySQL, SQLite) are first-class citizens in Explore for ad-hoc querying, cross-DB joins, and DML (`INSERT INTO`, `UPDATE`), with schema DDL safely managed by external native tools.
96
+ - **Clear Engine Boundary (SSDT vs Federation):** Full declarative DDL lifecycle management specifically engineered for DuckDB, DuckLake, Quack, and MotherDuck (with a physical copy-and-swap Parquet rewrite guard `--allow-lake-rewrite` and automatic `set_commit_message` snapshot tagging for DuckLake). External attached engines (MSSQL, PostgreSQL, MySQL, SQLite) are first-class citizens in Explore for ad-hoc querying, cross-DB joins, and DML (`INSERT INTO`, `UPDATE`), with schema DDL safely managed by external native tools.
96
97
  - **Interactive Apply Parity (CLI & Notebook):** Review visual colored diffs and apply migrations interactively with live confirmation prompts in terminal, Python scripts, or Jupyter notebooks (with automated external terminal pop-out).
97
98
  - **Schema Drift Detection (`duckpack diff`):** Instant dry-run inspection to detect divergence between your declarative codebase and live databases without mutating state.
98
99
  - **Git-Style Smart Renames:** Uses Jaro-Winkler similarity matching (>80%) to detect renamed tables or columns, issuing non-destructive `ALTER TABLE RENAME` statements instead of dropping and recreating data.
99
100
  - **Built-in Interactive Terminal IDE:** Explore live databases, write queries with syntax highlighting and autocompletion (`Ctrl+Space`), and manage independent query tabs.
100
- - **Unified IDE Authoring & Project Mode (`F3: DB | F4: Project`):** Toggle between live database catalog inspection and declarative project authoring. Scaffold tables, views, macros, and schemas (`a`/`n`), edit with dirty tab indicators (`*`), validate project syntax and dependencies against an in-memory Shadow DB (`Ctrl+B`/`v`), inspect passive Git status badges (`[M]`, `[+]`, `[D]`), and run declarative diff & apply (`F6`/`Ctrl+D`) directly without quitting the IDE.
101
+ - **Unified IDE Authoring & Project Mode (`F3: DB | F4: Project`):** Toggle between live database catalog inspection and declarative project authoring. Scaffold tables, views, macros, sequences, and schemas (`a`/`n`), edit with dirty tab indicators (`*`), validate project syntax and dependencies against an in-memory Shadow DB (`Ctrl+B`/`v`), inspect passive Git status badges (`[M]`, `[+]`, `[D]`), and run declarative diff & apply (`F6`/`Ctrl+D`) directly without quitting the IDE.
101
102
  - **Visual Primary Key & Foreign Key Indicators:** Inspect table structures in the Explorer tree with visual icons (`🔑` for Primary Keys, `🔗` for Foreign Keys with reference targets `[FK -> table.col]`, and composite `🔑🔗` badges).
102
103
  - **Dynamic Explorer Width Resizing & Snappy Scrolling:** Adjust sidebar width on the fly via `W` (cycling 25%/35%/50% presets) or `+`/`-` and `[`/`]` (5% increments from 15% to 60%). Navigate wide schemas quickly with 4-char arrow scrolling, `Shift+Arrow` 10-char jumps, and `Home` margin snap.
103
- - **Catalog-Aware Multi-Database Exploration:** Inspect multiple attached catalogs (local DuckDB, in-memory `memory` scratchpad, attached SQLite/Postgres/MySQL/MSSQL, and remote Quack `target_db` instances) in a unified hierarchical tree with catalog-qualified query generation and cross-database joins.
104
- - **Live Catalog Attach with Provider Presets (`Ctrl+A` / `d` / `b`):** Dynamically attach third-party databases, DuckDB files, MotherDuck, or remote Quack instances directly inside the IDE with provider presets and auto-installed extensions; cycle target catalogs on the fly.
104
+ - **Catalog-Aware Multi-Database Exploration:** Inspect multiple attached catalogs (local DuckDB, in-memory `memory` scratchpad, DuckLake lakehouses `🌊`, attached SQLite/Postgres/MySQL/MSSQL `🔌`, and remote Quack `target_db` instances) in a unified hierarchical tree with catalog-qualified query generation, cross-database joins, and live external catalog cache invalidation (`r`).
105
+ - **Live Catalog Attach with Provider Presets & DuckLake Triad (`Ctrl+A` / `d` / `b` / `t`):** Dynamically attach DuckLake lakehouses (with `DuckDB File`, `PostgreSQL`, `SQLite`, or `Quack` metadata backends + `DATA_PATH` + S3 secret auto-binding), inspect versioned commits under `📸 Snapshots (N)`, and launch the interactive **Time-Travel & Snapshot Diff Modal (`t`)** (`AT (VERSION => N)`, `AT (TIMESTAMP => '...')`, `ducklake_table_changes(...)`); also attach third-party databases (including MSSQL Windows Auth / `Trusted_Connection`), DuckDB files, MotherDuck, or remote Quack instances directly inside the IDE with full cursor-navigable modal inputs.
105
106
  - **Cloud Secrets Management & S3 Bucket Explorer (`Ctrl+K`):** Visually configure cloud storage credentials (AWS S3, Cloudflare R2, MinIO, Wasabi, Custom S3) with masked inputs (`*`) and dual-persistence (`CREATE PERSISTENT SECRET` + `.env`). Live-explore remote S3 buckets (`glob()`) and sample remote files (`read_parquet`, `read_csv`) with a single keypress.
106
107
  - **Temporary Table Discovery & Python Two-Way Sync:** Temporary tables and views (`CREATE TEMP TABLE ...`) appear seamlessly in the active database's Explorer tree with a distinct `[temp]` badge. Instant DDL auto-refresh updates the sidebar on `CREATE`/`DROP`/`ALTER`, and interactive Python exploration (`duckpack.explore(con)`) performs safe two-way session synchronization across the Quack bridge.
107
108
  - **Python Integration with Jupyter / VS Code Support:** Import `duckpack` into Python pipelines, pytest fixtures, or Jupyter notebooks (`duckpack.explore(con)`). Automatically spawns a connected native terminal window in non-interactive notebook environments.
@@ -191,12 +192,12 @@ cargo install duckpack
191
192
  | `duckpack init` | Scaffold a new declarative database project | `-p, --project-dir <DIR>` | `.` |
192
193
  | `duckpack build` | Validate SQL syntax against an in-memory Shadow DB | `-p, --project-dir <DIR>` | `.` |
193
194
  | `duckpack diff` | Compare declarative project state against target database without applying changes | `-p, --project-dir <DIR>`<br>`-d, --db <URI>`<br>`--database, --catalog <NAME>`<br>`--quack-token <TOKEN>`<br>`--insecure` | `.`<br>`local.duckdb`<br>`None`<br>`None`<br>`false` |
194
- | `duckpack apply` | Compute diff and apply migrations to target database | `-p, --project-dir <DIR>`<br>`-d, --db <URI>`<br>`--database, --catalog <NAME>`<br>`--auto-approve`<br>`--interactive`<br>`--force-drop`<br>`--out <FILE>`<br>`--quack-token <TOKEN>`<br>`--insecure` | `.`<br>`local.duckdb`<br>`None`<br>`false`<br>`false`<br>`false`<br>`None`<br>`None`<br>`false` |
195
+ | `duckpack apply` | Compute diff and apply migrations to target database | `-p, --project-dir <DIR>`<br>`-d, --db <URI>`<br>`--database, --catalog <NAME>`<br>`--auto-approve`<br>`--interactive`<br>`--force-drop`<br>`--allow-lake-rewrite`<br>`--out <FILE>`<br>`--quack-token <TOKEN>`<br>`--insecure` | `.`<br>`local.duckdb`<br>`None`<br>`false`<br>`false`<br>`false`<br>`false`<br>`None`<br>`None`<br>`false` |
195
196
  | `duckpack explore` | Open the interactive terminal IDE / query editor | `-p, --project-dir <DIR>`<br>`-d, --db <URI>`<br>`--database, --catalog <NAME>`<br>`--remote <SSH_TARGET>`<br>`-P, --port <PORT>`<br>`--auto-install`<br>`--quack-token <TOKEN>`<br>`--insecure` | `.`<br>`local.duckdb`<br>`None`<br>`None`<br>`22`<br>`false`<br>`None`<br>`false` |
196
197
  | `duckpack compile` | Package project into an immutable `.duckpack` snapshot | `-p, --project-dir <DIR>`<br>`-o, --out <FILE>` | `.`<br>*(Required)* |
197
198
  | `duckpack deploy` | Deploy compiled project to a remote server over SSH | `-p, --project-dir <DIR>`<br>`-r, --remote <HOST>`<br>`-d, --db <URI>`<br>`-P, --port <PORT>`<br>`--auto-install` | `.`<br>*(Required)*<br>`local.duckdb`<br>`22`<br>`false` |
198
- | `duckpack python status` | Check if Python bindings are installed in active environment | — | — |
199
- | `duckpack python install` | Install/upgrade `duckpack` Python package via pip | `--upgrade` | `false` |
199
+ | `duckpack python status` | Check active Python environment (`$VIRTUAL_ENV`, `./.venv`, or `python3`), detected installer (`uv` / `pip`), and installed versions | — | — |
200
+ | `duckpack python install` | Install/upgrade `duckpack` Python package in active environment (auto-detects `uv` or `pip`) | `-U, --upgrade`<br>`--installer, --method <auto\|uv\|pip>`<br>`--uv`<br>`--pip` | `false`<br>`auto`<br>`false`<br>`false` |
200
201
 
201
202
  ---
202
203
 
@@ -306,14 +307,14 @@ DuckPack embeds DuckDB directly as an in-process engine:
306
307
  - **Engine Transparency:** Check the exact embedded DuckDB engine version anytime via:
307
308
  ```bash
308
309
  duckpack --version
309
- # DuckPack v0.2.0 (embedded DuckDB v1.2.0)
310
+ # DuckPack v0.3.0 (embedded DuckDB v2.0.0)
310
311
  ```
311
312
  Or in Python:
312
313
  ```python
313
314
  import duckpack
314
315
 
315
- print(duckpack.__version__) # e.g. "0.2.0"
316
- print(duckpack.__duckdb_version__) # e.g. "1.2.0"
316
+ print(duckpack.__version__) # e.g. "0.3.0"
317
+ print(duckpack.__duckdb_version__) # e.g. "2.0.0"
317
318
  ```
318
319
  - **Proactive Storage Diagnostics:** If an older database file with an incompatible legacy storage format is encountered, DuckPack catches the internal engine error and prints clear migration guidance rather than an unhelpful internal crash dump.
319
320
 
@@ -363,7 +364,7 @@ Or transition instantly from `duckpack apply` by pressing **`e`**.
363
364
  | **Global / Navigation** | `Tab` | Cycle focus between **Explorer**, **Editor**, and **Results** panes |
364
365
  | | `?` | Toggle the Help Modal |
365
366
  | | `F3` / `1` | Switch Explorer to **Database Catalog** view (`target_db`, `memory`, attached DBs) |
366
- | | `F4` / `2` | Switch Explorer to **Project Files** view (`schemas/`, `tables/`, `views/`, `macros/`, `triggers/`, `queries/`, `seeds/`, `duckpack.toml`) |
367
+ | | `F4` / `2` | Switch Explorer to **Project Files** view (`schemas/`, `sequences/`, `tables/`, `views/`, `macros/`, `triggers/`, `queries/`, `seeds/`, `duckpack.toml`) |
367
368
  | | `F6` / `Ctrl+D` | **In-IDE Declarative Diff & Apply:** Review diff modal with `Space` toggling, dependency locks, and migration apply |
368
369
  | | `Ctrl+B` / `v` | **Validate Project:** Verify SQL syntax and cross-asset dependencies against Shadow DB |
369
370
  | | `Alt+W` | Cycle Explorer width presets (`25%` $\rightarrow$ `35%` $\rightarrow$ `50%`) |
@@ -383,7 +384,7 @@ Or transition instantly from `duckpack apply` by pressing **`e`**.
383
384
  | | `Ctrl+N` / `Ctrl+P` | Switch to the **Next** / **Previous** tab |
384
385
  | **Explorer** | `Up` / `Down` | Navigate through databases/categories, table groups, tables, and columns |
385
386
  | | `Enter` / `Space` | Expand or collapse tree folder / open SQL file in editor tab |
386
- | | `a` / `n` | **Quick Add Asset Modal** (in Project mode: Table, View, Macro, Trigger, Schema, Query, Seed) |
387
+ | | `a` / `n` | **Quick Add Asset Modal** (in Project mode: Table, View, Macro, Trigger, Sequence, Schema, Query, Seed) |
387
388
  | | `v` | **Validate Project** syntax and dependencies against Shadow DB (in Project mode) |
388
389
  | | `W` / `w` | **Cycle width presets:** `25%` $\rightarrow$ `35%` $\rightarrow$ `50%` $\rightarrow$ `25%` |
389
390
  | | `+` / `=` / `]` | **Widen Explorer** by +5% (up to 60%) |
@@ -391,14 +392,16 @@ Or transition instantly from `duckpack apply` by pressing **`e`**.
391
392
  | | `Left` / `Right` / `h` / `l` | **Scroll horizontally** by 4 characters |
392
393
  | | `Shift + Left` / `Right` | **Fast horizontal scroll** by 10 characters |
393
394
  | | `Home` | **Snap horizontal scroll** back to left margin |
394
- | | `q` / `s` | **Query table/view** (generates catalog-qualified SQL into editor) |
395
- | | `Ctrl+A` | **Attach Database** dialog with Provider Presets (DuckDB, SQLite, Postgres, MySQL, MotherDuck, Quack) |
395
+ | | `q` / `s` | **Query table/view/snapshot** (generates catalog-qualified SQL or `ducklake_snapshots()` into editor) |
396
+ | | `t` | **DuckLake Time-Travel & Snapshot Diff Modal:** Interactive picker for `AT (VERSION => N)`, `AT (TIMESTAMP => '...')`, and `ducklake_table_changes(...)` |
397
+ | | `Ctrl+A` | **Attach Database** dialog with Provider Presets (DuckDB, DuckLake, SQLite, Postgres, MySQL, MSSQL, MotherDuck, Quack) |
396
398
  | | `Ctrl+K` | **Cloud Secrets & S3 Buckets:** Add S3/R2/MinIO credentials with masking, `.env` persistence, and bucket exploration |
397
399
  | | `d` | **Detach Database** from current session |
398
400
  | | `b` | **Cycle Target Catalog** for diff/apply operations |
399
401
  | | `r` / `R` | **Refresh Explorer:** re-scans live database (in DB mode) or disk & git status (in Project mode) |
400
402
  | **In-IDE Diff & Apply** | `Space` | **Toggle selection** `[x]` / `[ ]` of highlighted migration with dependency locking `[L]` |
401
403
  | | `a` | **Toggle All:** select or deselect all eligible migrations |
404
+ | | `w` | **Toggle Allow Lake Rewrite (`[OFF/ON]`):** permit physical copy-and-swap table rewrites on DuckLake catalogs |
402
405
  | | `Enter` | **Apply selected changes** directly to target database catalog |
403
406
  | | `Esc` | **Close** diff review dialog without applying changes |
404
407
  | **Apply Review Screen** | `y` | **Confirm and apply** all pending declarative migrations |
@@ -420,10 +423,10 @@ DuckPack Explore features a dual-mode sidebar that brings the complete declarati
420
423
 
421
424
  - **Mode Switching (`F3` / `1` vs `F4` / `2`):**
422
425
  - **`[F3: Database Catalog]`**: Inspect live target and attached database catalogs, schemas, tables, views, triggers, columns, and constraints (`🔑`, `🔗`).
423
- - **`[F4: Project Files]`**: Browse declarative asset files organized categorically (`📁 Schemas`, `📦 Tables`, `👁️ Views`, `🔧 Macros`, `⚡ Triggers`, `📄 Queries`, `🌱 Seeds`, `⚙️ Config`).
424
- - **Complete Scaffolding & Zero-Exit Authoring:** All canonical project categories (`schemas/`, `tables/`, `views/`, `macros/`, `triggers/`, `queries/`, `seeds/`) are always rendered in the project sidebar tree—even if the underlying folder does not exist on disk yet. Empty categories show an interactive `(empty - press 'a' to add)` placeholder so developers never need to leave DuckPack to scaffold new directories or assets.
426
+ - **`[F4: Project Files]`**: Browse declarative asset files organized categorically (`📁 Schemas`, `🔢 Sequences`, `📦 Tables`, `👁️ Views`, `🔧 Macros`, `⚡ Triggers`, `📄 Queries`, `🌱 Seeds`, `⚙️ Config`).
427
+ - **Complete Scaffolding & Zero-Exit Authoring:** All canonical project categories (`schemas/`, `sequences/`, `tables/`, `views/`, `macros/`, `triggers/`, `queries/`, `seeds/`) are always rendered in the project sidebar tree—even if the underlying folder does not exist on disk yet. Empty categories show an interactive `(empty - press 'a' to add)` placeholder so developers never need to leave DuckPack to scaffold new directories or assets.
425
428
  - **Passive Git Awareness:** The Explorer header dynamically shows the current branch (e.g. `Project (main*) (25%)`), and files display status badges (`[M]` modified, `[+]` untracked, `[D]` deleted). DuckPack never commits or pushes, preserving index safety and SSH autonomy.
426
- - **Guided Asset Scaffolding (`a` or `n`):** Quick Add modal to scaffold a new Table, View, Macro, Trigger, Schema, Query, or Seed with clean boilerplate SQL/CSV. It automatically detects the selected folder category, creates the directory on disk if needed, writes the boilerplate, and opens the file in a new editor tab.
429
+ - **Guided Asset Scaffolding (`a` or `n`):** Quick Add modal to scaffold a new Table, View, Macro, Trigger, Sequence, Schema, Query, or Seed with clean boilerplate SQL/CSV. It automatically detects the selected folder category, creates the directory on disk if needed, writes the boilerplate, and opens the file in a new editor tab.
427
430
  - **Direct File Editing & Dirty Tab Tracking:** Opened files bind directly to disk. Tabs show `*` when dirty (`users.sql *`). Pressing `Ctrl+S` writes changes to disk, clears the dirty indicator, and refreshes project file badges.
428
431
  - **In-IDE Syntax Validation (`Ctrl+B` or `v`):** Compiles the entire project against an in-memory Shadow DB to verify SQL syntax, macros, and cross-asset dependencies with error line jumps.
429
432
  - **In-IDE Diff & Selective Apply (`F6` or `Ctrl+D`):** Computes declarative diffs against the active target database and presents an interactive diff modal directly inside the IDE. Supports `Space` to select/deselect individual changes with automatic dependency locking (`[L]`) and applies only the selected migrations on `Enter`.
@@ -482,13 +485,15 @@ Press **`Ctrl+A`** from anywhere in the IDE to open the interactive **Attach Dat
482
485
 
483
486
  - **Provider Presets (cycle via `◄` / `►` or `h` / `l`):**
484
487
  - **`DuckDB (Local / In-Memory)`**: Attach `.duckdb` files or `:memory:` scratchpads.
488
+ - **`DuckLake (Lakehouse)`**: Orchestrate a three-part DuckLake connection triad (`🌊`) with an interactive **Metadata Backend** picker (**`DuckDB File`**, **`PostgreSQL`**, **`SQLite`**, or **`Quack`** with `Disable SSL` support), storage **`DATA_PATH`** (`s3://bucket/path/` or local directory), optional **`data_inlining_row_limit`**, and automated S3/Quack secret binding.
485
489
  - **`Remote Quack Server`**: Connect to live remote Quack server instances with optional token credentials and SSL disable toggles.
486
490
  - **`MotherDuck Cloud`**: Attach MotherDuck cloud databases (`md:database_name`) with optional service token injection.
487
491
  - **`SQLite`**: Attach SQLite database files (`.db`, `.sqlite`) with automatic installation and loading of the DuckDB `sqlite` extension.
488
492
  - **`PostgreSQL`**: Connect to remote Postgres servers via structured input fields (Host, Port, Database, User ID, Password, SSL Mode).
489
493
  - **`MySQL`**: Connect to remote MySQL servers via structured input fields (Host, Port, Database, User ID, Password, SSL Mode).
490
- - **`Microsoft SQL Server (MSSQL)`**: Connect to remote SQL Server instances via structured input fields (Host, Port `1433`, Database, User ID `sa`, Password, Trust Server Certificate toggle).
491
- - **Structured Form Inputs**: No need to manually format complex connection strings; dedicated input boxes for Host, Port, Database, Username, Password, and Alias automatically assemble standard connection parameters.
494
+ - **`Microsoft SQL Server (MSSQL)`**: Connect to remote SQL Server instances via structured input fields (Host, Port `1433`, Database, User ID `sa`, Password, **Windows Auth (`Trusted_Connection=yes`)** toggle, and **Trust Server Certificate** toggle).
495
+ - **Full Cursor Navigation & Structured Inputs**: Edit any modal text box naturally using `◄`/`►`, `Home`, `End`, `Backspace`, and `Delete`, with 2D field navigation (`▲`/`▼`/`Tab` and `◄`/`►` on side-by-side Host/Port fields).
496
+ - **Live External Catalog Cache Refresh (`r` / `R`)**: Pressing `r` in the Explorer pane (or running DDL in the editor) automatically invalidates and refreshes cached metadata for attached **MSSQL** (`mssql_invalidate_cache` + `mssql_refresh_cache`), **PostgreSQL** (`pg_clear_cache`), **MySQL** (`mysql_clear_cache`), **MotherDuck**, and **Quack** catalogs so external changes (e.g. from dbt runs) appear immediately.
492
497
  - **Masked Token/Password Field**: Passwords and service tokens are rendered with `*` mask characters to protect against shoulder surfing or screen shares.
493
498
  - **Read-Only Toggle**: Press `Space` to toggle `READ_ONLY` mode.
494
499
  - **Safe Detach**: Select any attached database in the Explorer and press **`d`** (or `Delete`) to safely detach it from the active session.
@@ -694,8 +699,8 @@ import duckpack
694
699
  ```
695
700
 
696
701
  #### Engine Version Properties
697
- - **`duckpack.__version__: str`**: The version of DuckPack (e.g. `"0.2.0"`).
698
- - **`duckpack.__duckdb_version__: str`**: The embedded DuckDB engine version (e.g. `"1.2.0"`).
702
+ - **`duckpack.__version__: str`**: The version of DuckPack (e.g. `"0.3.0"`).
703
+ - **`duckpack.__duckdb_version__: str`**: The embedded DuckDB engine version (e.g. `"2.0.0"`).
699
704
 
700
705
  #### Functions
701
706
 
@@ -705,8 +710,8 @@ import duckpack
705
710
  - **`duckpack.stop_server() -> bool`**
706
711
  Stops any active background Quack session bridge started by `duckpack.explore(con)` in a notebook.
707
712
 
708
- - **`duckpack.apply(target=None, project_dir=".", auto_approve=True, force_drop=False, interactive=False, database=None, catalog=None, env=None) -> ApplyResult`**
709
- Computes schema diffs and applies declarative migrations. In interactive mode (`auto_approve=False` or `interactive=True`), opens the visual review TUI. When `target=None`, auto-resolves database targets from `duckpack.toml`. Returns an `ApplyResult`.
713
+ - **`duckpack.apply(target=None, project_dir=".", auto_approve=True, force_drop=False, allow_lake_rewrite=False, interactive=False, database=None, catalog=None, env=None) -> ApplyResult`**
714
+ Computes schema diffs and applies declarative migrations. In interactive mode (`auto_approve=False` or `interactive=True`), opens the visual review TUI. When targeting a DuckLake catalog, physical copy-and-swap table rewrites (`RecreateTable`) are blocked unless `allow_lake_rewrite=True` is passed, and applied migrations automatically tag the DuckLake snapshot via `set_commit_message`. When `target=None`, auto-resolves database targets from `duckpack.toml`. Returns an `ApplyResult`.
710
715
 
711
716
  - **`duckpack.diff(target=None, project_dir=".", database=None, catalog=None, env=None) -> DiffSummary`**
712
717
  Compares declarative project state against target database or attached catalog without mutating data. When `target=None`, auto-resolves from `duckpack.toml`. Returns a `DiffSummary`.
@@ -730,14 +735,19 @@ import duckpack
730
735
 
731
736
  ### CLI Python Management
732
737
 
733
- Check and install the Python bindings directly from the standalone DuckPack CLI:
738
+ Check and install the Python bindings directly from the standalone DuckPack CLI. `duckpack python` automatically detects `$VIRTUAL_ENV`, `./.venv`, and whether your environment is managed by **`uv`** (`uv.lock` / `pyvenv.cfg` / missing `pip`) or **`pip`**:
734
739
 
735
740
  ```bash
736
- # Verify Python extension status in active environment
741
+ # Verify Python interpreter, detected installer (uv or pip), and installed package versions
737
742
  duckpack python status
738
743
 
739
- # Install or upgrade duckpack in active environment via pip
744
+ # Install or upgrade duckpack in the active environment (auto-detects uv vs pip)
740
745
  duckpack python install --upgrade
746
+
747
+ # Or explicitly select uv or pip:
748
+ duckpack python install --uv -U
749
+ duckpack python install --pip -U
750
+ duckpack python install --installer uv
741
751
  ```
742
752
 
743
753
  ---
@@ -837,6 +847,8 @@ Running `duckpack init --project-dir my_project` generates the standard declarat
837
847
  ```
838
848
  my_project/
839
849
  ├── schemas/ # CREATE SCHEMA statements (supports nested schemas e.g. finance/reports.sql)
850
+ ├── types/ # CREATE TYPE statements (enums, composite types)
851
+ ├── sequences/ # CREATE SEQUENCE statements (compiled before tables to support DEFAULT nextval('...'))
840
852
  ├── tables/ # CREATE TABLE statements (one table per .sql file; VARIANT types supported)
841
853
  ├── views/ # CREATE VIEW & CREATE SECURE VIEW statements (engine auto-forces OR REPLACE)
842
854
  ├── macros/ # CREATE MACRO statements (supports DuckDB 2.0 lambda x: ... syntax)
@@ -848,11 +860,12 @@ my_project/
848
860
  │ └── post-deploy/ # Raw SQL executed AFTER migrations are applied
849
861
  ├── duckpack.toml # Multi-environment targets configuration
850
862
  ├── .env # Environment variables for ${VAR} template substitution
851
- └── .duckdbignore # Ignore patterns for tables/views
863
+ ├── .duckpackignore # Ignore patterns for tables, views, sequences, triggers, and deployment scripts
852
864
  ```
853
865
 
854
866
  ### DuckDB v2.0 Authoring Guidelines
855
867
 
868
+ - **First-Class Sequences & Surrogate Keys:** DuckDB eagerly validates sequence references at table creation time. Define sequence definitions in `sequences/` (e.g. `sequences/external_metric_id_seq.sql`). DuckPack compiles them prior to `tables/` during both Shadow DB compilation and migration execution, ensuring tables with surrogate keys (`DEFAULT nextval('...')`) compile and apply without dependency errors.
856
869
  - **Arbitrary Nested Schemas:** Schemas can be nested to any depth (`CREATE SCHEMA finance.reports;`). Table files can live in nested subdirectories (`tables/finance/reports/q3.sql`) or dot-named files (`tables/finance.reports.q3.sql`). DuckPack automatically resolves topological creation order (parents before children) and teardown order (children before parents).
857
870
  - **First-Class `VARIANT` Columns:** Tables and views support native `VARIANT` types and `variant_*` functions alongside JSON casts (`::JSON::VARIANT`). In-place type alterations (`ALTER TABLE t ALTER c TYPE VARIANT`) are applied without requiring table recreation.
858
871
  - **`CREATE SECURE VIEW`:** Secure views are fully supported in `views/`. When views are modified, DuckPack automatically emits `CREATE OR REPLACE SECURE VIEW` to preserve view protection.
@@ -870,7 +883,7 @@ Define connection targets, remote Quack instances, and environment profiles with
870
883
  ```toml
871
884
  [project]
872
885
  name = "analytics_warehouse"
873
- version = "0.2.0"
886
+ version = "0.3.0"
874
887
 
875
888
  [target]
876
889
  default_db = "dev.duckdb"
@@ -890,6 +903,23 @@ db = "quack:staging.company.internal:9494"
890
903
  database = "analytics_stg"
891
904
  insecure = true # Disable SSL for internal/self-signed deployments
892
905
 
906
+ [env.lakehouse]
907
+ # Attach a DuckLake lakehouse catalog (DuckDB File, Postgres, SQLite, or Quack backend) + S3 storage:
908
+ provider = "ducklake"
909
+ catalog_dsn = "quack:localhost:9494"
910
+ data_path = "s3://warehouse/gold/"
911
+ inlining_limit = 1000
912
+ insecure = true # Passes METADATA_PARAMETERS MAP {'DISABLE_SSL': true} for Quack backend
913
+
914
+ [env.sqlserver]
915
+ # Attach a Microsoft SQL Server instance (with SQL Auth or Windows Authentication):
916
+ provider = "mssql"
917
+ host = "sqlserver.corp.local"
918
+ port = 1433
919
+ database = "analytics_dw"
920
+ trusted_connection = true # Windows Authentication (or set user / password_env)
921
+ trust_server_certificate = true
922
+
893
923
  [env.prod]
894
924
  # Connect to production Quack or MotherDuck:
895
925
  db = "quack:analytics.company.com:443"
@@ -928,16 +958,27 @@ CREATE TABLE ${ENV}_customers_${REGION} (
928
958
  ```
929
959
  DuckPack loads `.env` (or `.env.<profile>` when using `--env <profile>`) and interpolates variables via regex before compiling.
930
960
 
931
- ### Ignoring Tables (`.duckdbignore`)
961
+ ### Ignoring Assets & Scripts (`.duckpackignore`)
932
962
 
933
- Specify glob patterns for tables or views that DuckPack should ignore during schema diffs:
963
+ Specify glob patterns for tables, views, sequences, triggers, or file paths from any directory (including `scripts/pre-deploy` and `scripts/post-deploy`) that DuckPack should ignore:
934
964
  ```
935
- # Ignore ephemeral tables and temp backups
965
+ # Ignore ephemeral tables, backups, or schemas
936
966
  temp_*
937
967
  *_backup
938
968
  scratch.*
969
+
970
+ # Ignore one-time deployment scripts after their initial run
971
+ scripts/pre-deploy/01_one_time_seed.sql
972
+ scripts/post-deploy/02_cleanup_staging.sql
973
+
974
+ # Ignore an entire directory or wildcard paths
975
+ archive/
976
+ scripts/post-deploy/legacy_*
939
977
  ```
940
978
 
979
+ > [!TIP]
980
+ > **One-Time Deploy Scripts**: Place bootstrap or one-off data migration scripts in `scripts/pre-deploy/` or `scripts/post-deploy/` during your initial release. Once executed, add the file name or relative path (e.g. `01_one_time_seed.sql` or `scripts/pre-deploy/01_one_time_seed.sql`) to `.duckpackignore` so DuckPack safely bypasses it on subsequent deploys. DuckPack automatically supports legacy `.duckdbignore` and `.duckignore` filenames as fallbacks.
981
+
941
982
  ---
942
983
 
943
984
  ## 📦 DuckPacks (`.duckpack`) for CI/CD