duckpack 0.2.2__tar.gz → 0.2.3__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.
- {duckpack-0.2.2 → duckpack-0.2.3}/Cargo.lock +1 -1
- {duckpack-0.2.2 → duckpack-0.2.3}/Cargo.toml +1 -1
- {duckpack-0.2.2 → duckpack-0.2.3}/PKG-INFO +58 -24
- {duckpack-0.2.2 → duckpack-0.2.3}/README.md +57 -23
- {duckpack-0.2.2 → duckpack-0.2.3}/pyproject.toml +1 -1
- {duckpack-0.2.2 → duckpack-0.2.3}/scripts/scaffold_demo_project.sh +1 -1
- {duckpack-0.2.2 → duckpack-0.2.3}/src/catalog.rs +148 -56
- {duckpack-0.2.2 → duckpack-0.2.3}/src/diff.rs +527 -9
- {duckpack-0.2.2 → duckpack-0.2.3}/src/engine.rs +1312 -34
- {duckpack-0.2.2 → duckpack-0.2.3}/src/ide/explorer.rs +15 -1
- {duckpack-0.2.2 → duckpack-0.2.3}/src/ide/mod.rs +450 -86
- {duckpack-0.2.2 → duckpack-0.2.3}/src/ide/modals.rs +1893 -700
- {duckpack-0.2.2 → duckpack-0.2.3}/src/query.rs +19 -2
- {duckpack-0.2.2 → duckpack-0.2.3}/src/tui.rs +22 -8
- {duckpack-0.2.2 → duckpack-0.2.3}/tests/test_python_api.py +1 -1
- {duckpack-0.2.2 → duckpack-0.2.3}/tests/v2_compat_test.rs +11 -1
- {duckpack-0.2.2 → duckpack-0.2.3}/.cargo/config.toml +0 -0
- {duckpack-0.2.2 → duckpack-0.2.3}/.github/workflows/release.yml +0 -0
- {duckpack-0.2.2 → duckpack-0.2.3}/.gitignore +0 -0
- {duckpack-0.2.2 → duckpack-0.2.3}/LICENSE +0 -0
- {duckpack-0.2.2 → duckpack-0.2.3}/duckpack_logo.png +0 -0
- {duckpack-0.2.2 → duckpack-0.2.3}/python/duckpack/__init__.py +0 -0
- {duckpack-0.2.2 → duckpack-0.2.3}/python/duckpack/__main__.py +0 -0
- {duckpack-0.2.2 → duckpack-0.2.3}/python/duckpack/_duckpack.pyi +0 -0
- {duckpack-0.2.2 → duckpack-0.2.3}/python/duckpack/cli.py +0 -0
- {duckpack-0.2.2 → duckpack-0.2.3}/python/duckpack/notebook.py +0 -0
- {duckpack-0.2.2 → duckpack-0.2.3}/python/duckpack/py.typed +0 -0
- {duckpack-0.2.2 → duckpack-0.2.3}/python/duckpack/runner.py +0 -0
- {duckpack-0.2.2 → duckpack-0.2.3}/python/duckpack/terminal.py +0 -0
- {duckpack-0.2.2 → duckpack-0.2.3}/src/ide/editor.rs +0 -0
- {duckpack-0.2.2 → duckpack-0.2.3}/src/lib.rs +0 -0
- {duckpack-0.2.2 → duckpack-0.2.3}/src/main.rs +0 -0
- {duckpack-0.2.2 → duckpack-0.2.3}/src/python.rs +0 -0
- {duckpack-0.2.2 → duckpack-0.2.3}/src/syntax.rs +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: duckpack
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
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
|
|
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,7 +89,8 @@ 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
96
|
- **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.
|
|
@@ -97,11 +98,11 @@ DuckPack includes a **rich terminal IDE** for live database exploration and firs
|
|
|
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
|
|
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
|
|
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`):** Dynamically attach DuckLake lakehouses (with `DuckDB File`, `PostgreSQL`, `SQLite`, or `Quack` metadata backends + `DATA_PATH` + S3 secret auto-binding), 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; cycle target catalogs on the fly.
|
|
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.
|
|
@@ -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.
|
|
310
|
+
# DuckPack v0.2.3 (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.
|
|
316
|
-
print(duckpack.__duckdb_version__) # e.g. "
|
|
316
|
+
print(duckpack.__version__) # e.g. "0.2.3"
|
|
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%) |
|
|
@@ -420,10 +421,10 @@ DuckPack Explore features a dual-mode sidebar that brings the complete declarati
|
|
|
420
421
|
|
|
421
422
|
- **Mode Switching (`F3` / `1` vs `F4` / `2`):**
|
|
422
423
|
- **`[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.
|
|
424
|
+
- **`[F4: Project Files]`**: Browse declarative asset files organized categorically (`📁 Schemas`, `🔢 Sequences`, `📦 Tables`, `👁️ Views`, `🔧 Macros`, `⚡ Triggers`, `📄 Queries`, `🌱 Seeds`, `⚙️ Config`).
|
|
425
|
+
- **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
426
|
- **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.
|
|
427
|
+
- **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
428
|
- **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
429
|
- **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
430
|
- **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 +483,15 @@ Press **`Ctrl+A`** from anywhere in the IDE to open the interactive **Attach Dat
|
|
|
482
483
|
|
|
483
484
|
- **Provider Presets (cycle via `◄` / `►` or `h` / `l`):**
|
|
484
485
|
- **`DuckDB (Local / In-Memory)`**: Attach `.duckdb` files or `:memory:` scratchpads.
|
|
486
|
+
- **`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
487
|
- **`Remote Quack Server`**: Connect to live remote Quack server instances with optional token credentials and SSL disable toggles.
|
|
486
488
|
- **`MotherDuck Cloud`**: Attach MotherDuck cloud databases (`md:database_name`) with optional service token injection.
|
|
487
489
|
- **`SQLite`**: Attach SQLite database files (`.db`, `.sqlite`) with automatic installation and loading of the DuckDB `sqlite` extension.
|
|
488
490
|
- **`PostgreSQL`**: Connect to remote Postgres servers via structured input fields (Host, Port, Database, User ID, Password, SSL Mode).
|
|
489
491
|
- **`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
|
|
492
|
+
- **`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).
|
|
493
|
+
- **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).
|
|
494
|
+
- **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
495
|
- **Masked Token/Password Field**: Passwords and service tokens are rendered with `*` mask characters to protect against shoulder surfing or screen shares.
|
|
493
496
|
- **Read-Only Toggle**: Press `Space` to toggle `READ_ONLY` mode.
|
|
494
497
|
- **Safe Detach**: Select any attached database in the Explorer and press **`d`** (or `Delete`) to safely detach it from the active session.
|
|
@@ -694,8 +697,8 @@ import duckpack
|
|
|
694
697
|
```
|
|
695
698
|
|
|
696
699
|
#### Engine Version Properties
|
|
697
|
-
- **`duckpack.__version__: str`**: The version of DuckPack (e.g. `"0.2.
|
|
698
|
-
- **`duckpack.__duckdb_version__: str`**: The embedded DuckDB engine version (e.g. `"
|
|
700
|
+
- **`duckpack.__version__: str`**: The version of DuckPack (e.g. `"0.2.3"`).
|
|
701
|
+
- **`duckpack.__duckdb_version__: str`**: The embedded DuckDB engine version (e.g. `"2.0.0"`).
|
|
699
702
|
|
|
700
703
|
#### Functions
|
|
701
704
|
|
|
@@ -837,6 +840,8 @@ Running `duckpack init --project-dir my_project` generates the standard declarat
|
|
|
837
840
|
```
|
|
838
841
|
my_project/
|
|
839
842
|
├── schemas/ # CREATE SCHEMA statements (supports nested schemas e.g. finance/reports.sql)
|
|
843
|
+
├── types/ # CREATE TYPE statements (enums, composite types)
|
|
844
|
+
├── sequences/ # CREATE SEQUENCE statements (compiled before tables to support DEFAULT nextval('...'))
|
|
840
845
|
├── tables/ # CREATE TABLE statements (one table per .sql file; VARIANT types supported)
|
|
841
846
|
├── views/ # CREATE VIEW & CREATE SECURE VIEW statements (engine auto-forces OR REPLACE)
|
|
842
847
|
├── macros/ # CREATE MACRO statements (supports DuckDB 2.0 lambda x: ... syntax)
|
|
@@ -848,11 +853,12 @@ my_project/
|
|
|
848
853
|
│ └── post-deploy/ # Raw SQL executed AFTER migrations are applied
|
|
849
854
|
├── duckpack.toml # Multi-environment targets configuration
|
|
850
855
|
├── .env # Environment variables for ${VAR} template substitution
|
|
851
|
-
|
|
856
|
+
├── .duckpackignore # Ignore patterns for tables, views, sequences, triggers, and deployment scripts
|
|
852
857
|
```
|
|
853
858
|
|
|
854
859
|
### DuckDB v2.0 Authoring Guidelines
|
|
855
860
|
|
|
861
|
+
- **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
862
|
- **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
863
|
- **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
864
|
- **`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 +876,7 @@ Define connection targets, remote Quack instances, and environment profiles with
|
|
|
870
876
|
```toml
|
|
871
877
|
[project]
|
|
872
878
|
name = "analytics_warehouse"
|
|
873
|
-
version = "0.2.
|
|
879
|
+
version = "0.2.3"
|
|
874
880
|
|
|
875
881
|
[target]
|
|
876
882
|
default_db = "dev.duckdb"
|
|
@@ -890,6 +896,23 @@ db = "quack:staging.company.internal:9494"
|
|
|
890
896
|
database = "analytics_stg"
|
|
891
897
|
insecure = true # Disable SSL for internal/self-signed deployments
|
|
892
898
|
|
|
899
|
+
[env.lakehouse]
|
|
900
|
+
# Attach a DuckLake lakehouse catalog (DuckDB File, Postgres, SQLite, or Quack backend) + S3 storage:
|
|
901
|
+
provider = "ducklake"
|
|
902
|
+
catalog_dsn = "quack:localhost:9494"
|
|
903
|
+
data_path = "s3://warehouse/gold/"
|
|
904
|
+
inlining_limit = 1000
|
|
905
|
+
insecure = true # Passes METADATA_PARAMETERS MAP {'DISABLE_SSL': true} for Quack backend
|
|
906
|
+
|
|
907
|
+
[env.sqlserver]
|
|
908
|
+
# Attach a Microsoft SQL Server instance (with SQL Auth or Windows Authentication):
|
|
909
|
+
provider = "mssql"
|
|
910
|
+
host = "sqlserver.corp.local"
|
|
911
|
+
port = 1433
|
|
912
|
+
database = "analytics_dw"
|
|
913
|
+
trusted_connection = true # Windows Authentication (or set user / password_env)
|
|
914
|
+
trust_server_certificate = true
|
|
915
|
+
|
|
893
916
|
[env.prod]
|
|
894
917
|
# Connect to production Quack or MotherDuck:
|
|
895
918
|
db = "quack:analytics.company.com:443"
|
|
@@ -928,16 +951,27 @@ CREATE TABLE ${ENV}_customers_${REGION} (
|
|
|
928
951
|
```
|
|
929
952
|
DuckPack loads `.env` (or `.env.<profile>` when using `--env <profile>`) and interpolates variables via regex before compiling.
|
|
930
953
|
|
|
931
|
-
### Ignoring
|
|
954
|
+
### Ignoring Assets & Scripts (`.duckpackignore`)
|
|
932
955
|
|
|
933
|
-
Specify glob patterns for tables or
|
|
956
|
+
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
957
|
```
|
|
935
|
-
# Ignore ephemeral tables
|
|
958
|
+
# Ignore ephemeral tables, backups, or schemas
|
|
936
959
|
temp_*
|
|
937
960
|
*_backup
|
|
938
961
|
scratch.*
|
|
962
|
+
|
|
963
|
+
# Ignore one-time deployment scripts after their initial run
|
|
964
|
+
scripts/pre-deploy/01_one_time_seed.sql
|
|
965
|
+
scripts/post-deploy/02_cleanup_staging.sql
|
|
966
|
+
|
|
967
|
+
# Ignore an entire directory or wildcard paths
|
|
968
|
+
archive/
|
|
969
|
+
scripts/post-deploy/legacy_*
|
|
939
970
|
```
|
|
940
971
|
|
|
972
|
+
> [!TIP]
|
|
973
|
+
> **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.
|
|
974
|
+
|
|
941
975
|
---
|
|
942
976
|
|
|
943
977
|
## 📦 DuckPacks (`.duckpack`) for CI/CD
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="duckpack_logo.png" width="400" alt="DuckPack Logo" />
|
|
2
|
+
<img src="https://raw.githubusercontent.com/Benjas86/duckpack/main/duckpack_logo.png" width="400" alt="DuckPack Logo" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
@@ -61,7 +61,7 @@ DuckPack includes a **rich terminal IDE** for live database exploration and firs
|
|
|
61
61
|
- [Directory Layout](#directory-layout)
|
|
62
62
|
- [Configuration (`duckpack.toml`)](#configuration-duckpacktoml)
|
|
63
63
|
- [Environment Variables (`.env`)](#environment-variables-env)
|
|
64
|
-
- [Ignoring
|
|
64
|
+
- [Ignoring Assets & Scripts (`.duckpackignore`)](#ignoring-assets--scripts-duckpackignore)
|
|
65
65
|
- [📦 DuckPacks (`.duckpack`) for CI/CD](#-duckpacks-duckpack-for-cicd)
|
|
66
66
|
- [NOTE](#note)
|
|
67
67
|
|
|
@@ -69,7 +69,8 @@ DuckPack includes a **rich terminal IDE** for live database exploration and firs
|
|
|
69
69
|
|
|
70
70
|
## ✨ Features
|
|
71
71
|
|
|
72
|
-
- **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.
|
|
72
|
+
- **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.
|
|
73
|
+
- **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.
|
|
73
74
|
- **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.
|
|
74
75
|
- **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.
|
|
75
76
|
- **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.
|
|
@@ -77,11 +78,11 @@ DuckPack includes a **rich terminal IDE** for live database exploration and firs
|
|
|
77
78
|
- **Schema Drift Detection (`duckpack diff`):** Instant dry-run inspection to detect divergence between your declarative codebase and live databases without mutating state.
|
|
78
79
|
- **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.
|
|
79
80
|
- **Built-in Interactive Terminal IDE:** Explore live databases, write queries with syntax highlighting and autocompletion (`Ctrl+Space`), and manage independent query tabs.
|
|
80
|
-
- **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.
|
|
81
|
+
- **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.
|
|
81
82
|
- **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).
|
|
82
83
|
- **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.
|
|
83
|
-
- **Catalog-Aware Multi-Database Exploration:** Inspect multiple attached catalogs (local DuckDB, in-memory `memory` scratchpad, attached SQLite/Postgres/MySQL/MSSQL
|
|
84
|
-
- **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
|
|
84
|
+
- **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`).
|
|
85
|
+
- **Live Catalog Attach with Provider Presets & DuckLake Triad (`Ctrl+A` / `d` / `b`):** Dynamically attach DuckLake lakehouses (with `DuckDB File`, `PostgreSQL`, `SQLite`, or `Quack` metadata backends + `DATA_PATH` + S3 secret auto-binding), 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; cycle target catalogs on the fly.
|
|
85
86
|
- **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.
|
|
86
87
|
- **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.
|
|
87
88
|
- **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.
|
|
@@ -286,14 +287,14 @@ DuckPack embeds DuckDB directly as an in-process engine:
|
|
|
286
287
|
- **Engine Transparency:** Check the exact embedded DuckDB engine version anytime via:
|
|
287
288
|
```bash
|
|
288
289
|
duckpack --version
|
|
289
|
-
# DuckPack v0.2.
|
|
290
|
+
# DuckPack v0.2.3 (embedded DuckDB v2.0.0)
|
|
290
291
|
```
|
|
291
292
|
Or in Python:
|
|
292
293
|
```python
|
|
293
294
|
import duckpack
|
|
294
295
|
|
|
295
|
-
print(duckpack.__version__) # e.g. "0.2.
|
|
296
|
-
print(duckpack.__duckdb_version__) # e.g. "
|
|
296
|
+
print(duckpack.__version__) # e.g. "0.2.3"
|
|
297
|
+
print(duckpack.__duckdb_version__) # e.g. "2.0.0"
|
|
297
298
|
```
|
|
298
299
|
- **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.
|
|
299
300
|
|
|
@@ -343,7 +344,7 @@ Or transition instantly from `duckpack apply` by pressing **`e`**.
|
|
|
343
344
|
| **Global / Navigation** | `Tab` | Cycle focus between **Explorer**, **Editor**, and **Results** panes |
|
|
344
345
|
| | `?` | Toggle the Help Modal |
|
|
345
346
|
| | `F3` / `1` | Switch Explorer to **Database Catalog** view (`target_db`, `memory`, attached DBs) |
|
|
346
|
-
| | `F4` / `2` | Switch Explorer to **Project Files** view (`schemas/`, `tables/`, `views/`, `macros/`, `triggers/`, `queries/`, `seeds/`, `duckpack.toml`) |
|
|
347
|
+
| | `F4` / `2` | Switch Explorer to **Project Files** view (`schemas/`, `sequences/`, `tables/`, `views/`, `macros/`, `triggers/`, `queries/`, `seeds/`, `duckpack.toml`) |
|
|
347
348
|
| | `F6` / `Ctrl+D` | **In-IDE Declarative Diff & Apply:** Review diff modal with `Space` toggling, dependency locks, and migration apply |
|
|
348
349
|
| | `Ctrl+B` / `v` | **Validate Project:** Verify SQL syntax and cross-asset dependencies against Shadow DB |
|
|
349
350
|
| | `Alt+W` | Cycle Explorer width presets (`25%` $\rightarrow$ `35%` $\rightarrow$ `50%`) |
|
|
@@ -363,7 +364,7 @@ Or transition instantly from `duckpack apply` by pressing **`e`**.
|
|
|
363
364
|
| | `Ctrl+N` / `Ctrl+P` | Switch to the **Next** / **Previous** tab |
|
|
364
365
|
| **Explorer** | `Up` / `Down` | Navigate through databases/categories, table groups, tables, and columns |
|
|
365
366
|
| | `Enter` / `Space` | Expand or collapse tree folder / open SQL file in editor tab |
|
|
366
|
-
| | `a` / `n` | **Quick Add Asset Modal** (in Project mode: Table, View, Macro, Trigger, Schema, Query, Seed) |
|
|
367
|
+
| | `a` / `n` | **Quick Add Asset Modal** (in Project mode: Table, View, Macro, Trigger, Sequence, Schema, Query, Seed) |
|
|
367
368
|
| | `v` | **Validate Project** syntax and dependencies against Shadow DB (in Project mode) |
|
|
368
369
|
| | `W` / `w` | **Cycle width presets:** `25%` $\rightarrow$ `35%` $\rightarrow$ `50%` $\rightarrow$ `25%` |
|
|
369
370
|
| | `+` / `=` / `]` | **Widen Explorer** by +5% (up to 60%) |
|
|
@@ -400,10 +401,10 @@ DuckPack Explore features a dual-mode sidebar that brings the complete declarati
|
|
|
400
401
|
|
|
401
402
|
- **Mode Switching (`F3` / `1` vs `F4` / `2`):**
|
|
402
403
|
- **`[F3: Database Catalog]`**: Inspect live target and attached database catalogs, schemas, tables, views, triggers, columns, and constraints (`🔑`, `🔗`).
|
|
403
|
-
- **`[F4: Project Files]`**: Browse declarative asset files organized categorically (`📁 Schemas`, `📦 Tables`, `👁️ Views`, `🔧 Macros`, `⚡ Triggers`, `📄 Queries`, `🌱 Seeds`, `⚙️ Config`).
|
|
404
|
-
- **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.
|
|
404
|
+
- **`[F4: Project Files]`**: Browse declarative asset files organized categorically (`📁 Schemas`, `🔢 Sequences`, `📦 Tables`, `👁️ Views`, `🔧 Macros`, `⚡ Triggers`, `📄 Queries`, `🌱 Seeds`, `⚙️ Config`).
|
|
405
|
+
- **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.
|
|
405
406
|
- **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.
|
|
406
|
-
- **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.
|
|
407
|
+
- **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.
|
|
407
408
|
- **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.
|
|
408
409
|
- **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.
|
|
409
410
|
- **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`.
|
|
@@ -462,13 +463,15 @@ Press **`Ctrl+A`** from anywhere in the IDE to open the interactive **Attach Dat
|
|
|
462
463
|
|
|
463
464
|
- **Provider Presets (cycle via `◄` / `►` or `h` / `l`):**
|
|
464
465
|
- **`DuckDB (Local / In-Memory)`**: Attach `.duckdb` files or `:memory:` scratchpads.
|
|
466
|
+
- **`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.
|
|
465
467
|
- **`Remote Quack Server`**: Connect to live remote Quack server instances with optional token credentials and SSL disable toggles.
|
|
466
468
|
- **`MotherDuck Cloud`**: Attach MotherDuck cloud databases (`md:database_name`) with optional service token injection.
|
|
467
469
|
- **`SQLite`**: Attach SQLite database files (`.db`, `.sqlite`) with automatic installation and loading of the DuckDB `sqlite` extension.
|
|
468
470
|
- **`PostgreSQL`**: Connect to remote Postgres servers via structured input fields (Host, Port, Database, User ID, Password, SSL Mode).
|
|
469
471
|
- **`MySQL`**: Connect to remote MySQL servers via structured input fields (Host, Port, Database, User ID, Password, SSL Mode).
|
|
470
|
-
- **`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).
|
|
471
|
-
- **Structured
|
|
472
|
+
- **`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).
|
|
473
|
+
- **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).
|
|
474
|
+
- **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.
|
|
472
475
|
- **Masked Token/Password Field**: Passwords and service tokens are rendered with `*` mask characters to protect against shoulder surfing or screen shares.
|
|
473
476
|
- **Read-Only Toggle**: Press `Space` to toggle `READ_ONLY` mode.
|
|
474
477
|
- **Safe Detach**: Select any attached database in the Explorer and press **`d`** (or `Delete`) to safely detach it from the active session.
|
|
@@ -674,8 +677,8 @@ import duckpack
|
|
|
674
677
|
```
|
|
675
678
|
|
|
676
679
|
#### Engine Version Properties
|
|
677
|
-
- **`duckpack.__version__: str`**: The version of DuckPack (e.g. `"0.2.
|
|
678
|
-
- **`duckpack.__duckdb_version__: str`**: The embedded DuckDB engine version (e.g. `"
|
|
680
|
+
- **`duckpack.__version__: str`**: The version of DuckPack (e.g. `"0.2.3"`).
|
|
681
|
+
- **`duckpack.__duckdb_version__: str`**: The embedded DuckDB engine version (e.g. `"2.0.0"`).
|
|
679
682
|
|
|
680
683
|
#### Functions
|
|
681
684
|
|
|
@@ -817,6 +820,8 @@ Running `duckpack init --project-dir my_project` generates the standard declarat
|
|
|
817
820
|
```
|
|
818
821
|
my_project/
|
|
819
822
|
├── schemas/ # CREATE SCHEMA statements (supports nested schemas e.g. finance/reports.sql)
|
|
823
|
+
├── types/ # CREATE TYPE statements (enums, composite types)
|
|
824
|
+
├── sequences/ # CREATE SEQUENCE statements (compiled before tables to support DEFAULT nextval('...'))
|
|
820
825
|
├── tables/ # CREATE TABLE statements (one table per .sql file; VARIANT types supported)
|
|
821
826
|
├── views/ # CREATE VIEW & CREATE SECURE VIEW statements (engine auto-forces OR REPLACE)
|
|
822
827
|
├── macros/ # CREATE MACRO statements (supports DuckDB 2.0 lambda x: ... syntax)
|
|
@@ -828,11 +833,12 @@ my_project/
|
|
|
828
833
|
│ └── post-deploy/ # Raw SQL executed AFTER migrations are applied
|
|
829
834
|
├── duckpack.toml # Multi-environment targets configuration
|
|
830
835
|
├── .env # Environment variables for ${VAR} template substitution
|
|
831
|
-
|
|
836
|
+
├── .duckpackignore # Ignore patterns for tables, views, sequences, triggers, and deployment scripts
|
|
832
837
|
```
|
|
833
838
|
|
|
834
839
|
### DuckDB v2.0 Authoring Guidelines
|
|
835
840
|
|
|
841
|
+
- **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.
|
|
836
842
|
- **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).
|
|
837
843
|
- **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.
|
|
838
844
|
- **`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.
|
|
@@ -850,7 +856,7 @@ Define connection targets, remote Quack instances, and environment profiles with
|
|
|
850
856
|
```toml
|
|
851
857
|
[project]
|
|
852
858
|
name = "analytics_warehouse"
|
|
853
|
-
version = "0.2.
|
|
859
|
+
version = "0.2.3"
|
|
854
860
|
|
|
855
861
|
[target]
|
|
856
862
|
default_db = "dev.duckdb"
|
|
@@ -870,6 +876,23 @@ db = "quack:staging.company.internal:9494"
|
|
|
870
876
|
database = "analytics_stg"
|
|
871
877
|
insecure = true # Disable SSL for internal/self-signed deployments
|
|
872
878
|
|
|
879
|
+
[env.lakehouse]
|
|
880
|
+
# Attach a DuckLake lakehouse catalog (DuckDB File, Postgres, SQLite, or Quack backend) + S3 storage:
|
|
881
|
+
provider = "ducklake"
|
|
882
|
+
catalog_dsn = "quack:localhost:9494"
|
|
883
|
+
data_path = "s3://warehouse/gold/"
|
|
884
|
+
inlining_limit = 1000
|
|
885
|
+
insecure = true # Passes METADATA_PARAMETERS MAP {'DISABLE_SSL': true} for Quack backend
|
|
886
|
+
|
|
887
|
+
[env.sqlserver]
|
|
888
|
+
# Attach a Microsoft SQL Server instance (with SQL Auth or Windows Authentication):
|
|
889
|
+
provider = "mssql"
|
|
890
|
+
host = "sqlserver.corp.local"
|
|
891
|
+
port = 1433
|
|
892
|
+
database = "analytics_dw"
|
|
893
|
+
trusted_connection = true # Windows Authentication (or set user / password_env)
|
|
894
|
+
trust_server_certificate = true
|
|
895
|
+
|
|
873
896
|
[env.prod]
|
|
874
897
|
# Connect to production Quack or MotherDuck:
|
|
875
898
|
db = "quack:analytics.company.com:443"
|
|
@@ -908,16 +931,27 @@ CREATE TABLE ${ENV}_customers_${REGION} (
|
|
|
908
931
|
```
|
|
909
932
|
DuckPack loads `.env` (or `.env.<profile>` when using `--env <profile>`) and interpolates variables via regex before compiling.
|
|
910
933
|
|
|
911
|
-
### Ignoring
|
|
934
|
+
### Ignoring Assets & Scripts (`.duckpackignore`)
|
|
912
935
|
|
|
913
|
-
Specify glob patterns for tables or
|
|
936
|
+
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:
|
|
914
937
|
```
|
|
915
|
-
# Ignore ephemeral tables
|
|
938
|
+
# Ignore ephemeral tables, backups, or schemas
|
|
916
939
|
temp_*
|
|
917
940
|
*_backup
|
|
918
941
|
scratch.*
|
|
942
|
+
|
|
943
|
+
# Ignore one-time deployment scripts after their initial run
|
|
944
|
+
scripts/pre-deploy/01_one_time_seed.sql
|
|
945
|
+
scripts/post-deploy/02_cleanup_staging.sql
|
|
946
|
+
|
|
947
|
+
# Ignore an entire directory or wildcard paths
|
|
948
|
+
archive/
|
|
949
|
+
scripts/post-deploy/legacy_*
|
|
919
950
|
```
|
|
920
951
|
|
|
952
|
+
> [!TIP]
|
|
953
|
+
> **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.
|
|
954
|
+
|
|
921
955
|
---
|
|
922
956
|
|
|
923
957
|
## 📦 DuckPacks (`.duckpack`) for CI/CD
|
|
@@ -4,7 +4,7 @@ build-backend = "maturin"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "duckpack"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.3"
|
|
8
8
|
description = "Declarative schema management, interactive terminal IDE, and in-memory inspection for DuckDB"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [{ name = "Benjamen Terry", email = "benjamenjterry@gmail.com" }]
|
|
@@ -5,7 +5,7 @@ DEMO_DIR="demo_project"
|
|
|
5
5
|
echo "Scaffolding DuckPack Demo Project in '$DEMO_DIR'..."
|
|
6
6
|
|
|
7
7
|
rm -rf "$DEMO_DIR"
|
|
8
|
-
mkdir -p "$DEMO_DIR/schemas" "$DEMO_DIR/tables" "$DEMO_DIR/views" "$DEMO_DIR/queries" "$DEMO_DIR/macros"
|
|
8
|
+
mkdir -p "$DEMO_DIR/schemas" "$DEMO_DIR/sequences" "$DEMO_DIR/tables" "$DEMO_DIR/views" "$DEMO_DIR/queries" "$DEMO_DIR/macros"
|
|
9
9
|
|
|
10
10
|
# 1. Environment Profiles
|
|
11
11
|
cat << 'EOF' > "$DEMO_DIR/.env.staging"
|