Skip to main content

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-reports4.

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.query format.
  • 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

metabase_export-0.1.1.tar.gz (27.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

metabase_export-0.1.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file metabase_export-0.1.1.tar.gz.

File metadata

  • Download URL: metabase_export-0.1.1.tar.gz
  • Upload date:
  • Size: 27.0 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for metabase_export-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8b794e83e724f80258f7be8e9f66e5730bf65f0f9646d0a8190dd189e67d343a
MD5 9b9c2291dd05fd0fead53c02dead0bee
BLAKE2b-256 a64e871c325193623b96450bb0bba2ce1b1aaaba52f941fee4d68ff8d4ccf576

See more details on using hashes here.

File details

Details for the file metabase_export-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: metabase_export-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for metabase_export-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 49f6951f099bade7479e76961b06a6a60a7fe7e5c184276ee0dddb5483468bd6
MD5 b12e5fb712f9a7403aea05be999bedfa
BLAKE2b-256 df65f678fb9b517f01b90edf6e3777199aa76954db340c4b6584e2fca86444aa

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page