metabase-export
Export Metabase questions to .sql files that mirror your collection tree, so
your SQL lives in git.
uvx metabase-export --output reports
Every run rewrites the output directory. A card deleted or archived in
Metabase disappears from disk — it is a mirror, not a merge. Directories whose
name starts with _ are never touched.
Usage
Needs read access to the Metabase application database (metabaseappdb),
not to the databases Metabase reports against. The password comes from
METABASE_PG_PASSWORD or a prompt — never from a flag.
uvx metabase-export --output reports --root-collection 4 # one collection
uvx metabase-export --output reports --dry-run # change nothing
uvx metabase-export --output reports --port 15433 --ssh-host prod-box
Collection id comes from its URL: /collection/4-my-reports → 4.
| Option | Default | |
|---|---|---|
--output DIR |
reports |
where to write the tree |
--dry-run |
off | list changes, write nothing |
--root-collection ID |
all | export only this collection and its children |
--host --port --user --dbname |
127.0.0.1 5432 postgres metabaseappdb |
connection |
--ssh-host HOST |
— | tunnel --port through this host if it is closed |
--remote-port PORT |
5432 |
Postgres port on the far side |
Each option has an env var (METABASE_EXPORT_DIR, METABASE_PG_HOST, …; see
--help), so a project can pin its settings and run with no arguments.
Notes
- Only native (SQL) questions. Query-builder questions have no SQL and are skipped.
- Reads MBQL5 (Metabase 50+) and the older
native.queryformat. - Output is deterministic: two runs in a row leave the tree untouched.
- Files keep
{{parameter}}placeholders, so they are not runnable outside Metabase.
Development
uv sync && uv run pytest
MIT
Metadata
Release files for metabase-export 0.1.1
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 |
|---|---|---|---|---|
| metabase_export-0.1.1.tar.gz | 27.0 kB | Without provenance | Details for metabase_export-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| metabase_export-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for metabase_export-0.1.1-py3-none-any.whl |
Total release size: 35.1 kB
Release files / metabase_export-0.1.1.tar.gz
| Download URL | metabase_export-0.1.1.tar.gz |
|---|---|
| Size | 27.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b794e83e724f80258f7be8e9f66e5730bf65f0f9646d0a8190dd189e67d343a
|
|
BLAKE2b-256 checksum How to use checksums |
a64e871c325193623b96450bb0bba2ce1b1aaaba52f941fee4d68ff8d4ccf576
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / metabase_export-0.1.1-py3-none-any.whl
| Download URL | metabase_export-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
49f6951f099bade7479e76961b06a6a60a7fe7e5c184276ee0dddb5483468bd6
|
|
BLAKE2b-256 checksum How to use checksums |
df65f678fb9b517f01b90edf6e3777199aa76954db340c4b6584e2fca86444aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for metabase-export 0.1.1
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.