merlin
dbt lineage CLI — outputs Mermaid flowchart diagrams from manifest.json.
merlin +my_model+
Pipe the output into a GitHub PR description, embed it in documentation, or let an AI agent include it automatically.
Installation
curl (recommended)
curl -LsSf https://raw.githubusercontent.com/dgarhdez/merlin-dbt/main/install.sh | sh
npm
npm install -g merlin-dbt
pip / uv
pip install merlin-dbt
# or
uv tool install merlin-dbt
Usage
# Exact model only
merlin my_model
# Model and all upstream ancestors
merlin +my_model
# Model and all downstream descendants
merlin my_model+
# Full upstream + downstream subgraph
merlin +my_model+
# Use a specific dbt project directory
merlin +my_model+ --project-dir /path/to/dbt_project
# Emit raw Mermaid syntax (no fence, for scripting)
merlin +my_model+ --raw
Selector patterns
| Pattern | Meaning |
|---|---|
model |
Exact match only |
+model |
Model and all upstream ancestors |
model+ |
Model and all downstream descendants |
+model+ |
Model, all ancestors, and all descendants |
Traversal terminates at source() nodes. Sources have no upstream ancestors in the manifest and are treated as roots.
Node shapes in the diagram
| Resource type | Mermaid shape |
|---|---|
| model | rectangle |
| source | stadium |
| seed | hexagon |
| snapshot | hexagon |
Exit codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | User input error (model not found, invalid selector) |
| 2 | Environment error (manifest.json not found or invalid JSON) |
Requirements
- Python ≥ 3.10
- A dbt project with a current
manifest.jsonintarget/(rundbt compilefirst) - dbt Core 1.0+ (manifest schema v9+)
Known limitations
Code review workflow: merlin reads the manifest.json in your local target/ directory. When reviewing someone else's PR, your manifest reflects your own branch — not the PR author's. To see the PR author's lineage, check out their branch and run dbt compile first.
Large subgraphs: Selecting a highly connected model with +model+ may produce a diagram with many nodes. GitHub's Mermaid renderer may clip very large diagrams. Use a more specific selector to limit scope.
Example: GitHub Actions
- name: Add lineage diagram to PR
run: |
DIAGRAM=$(merlin +${{ env.CHANGED_MODEL }}+)
gh pr comment ${{ github.event.pull_request.number }} --body "$DIAGRAM"
License
MIT
Metadata
Release files for merlin-dbt 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| merlin_dbt-0.1.0.tar.gz | 9.2 kB | Without provenance | Details for merlin_dbt-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| merlin_dbt-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for merlin_dbt-0.1.0-py3-none-any.whl |
Total release size: 15.6 kB
Release files / merlin_dbt-0.1.0.tar.gz
| Download URL | merlin_dbt-0.1.0.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e6a4b0e558859d2e8317d96ede5975596f630fba249f2b3c8f455a5b832fcb05
|
|
BLAKE2b-256 checksum How to use checksums |
56f674eeefdf70d298d44fb337bf467896c1dc52f25a0e2d1a16e088d935325a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.3
|
Release files / merlin_dbt-0.1.0-py3-none-any.whl
| Download URL | merlin_dbt-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ae038dc72160573610cedf28824f1b24670a96a4a65fc3c20f6f4112c52e9e4f
|
|
BLAKE2b-256 checksum How to use checksums |
227107b87a6a28ac0e7f7a6bac4a762ff765db9bd0fd48b253dfebc1adffd8d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.3
|
Security for merlin-dbt 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.