Skip to main content

metabase-sync

PyPI Python CI License: MIT

Manage Metabase as files. Export your collections, questions, dashboards, snippets, and subscriptions to YAML, edit them, and apply the changes back, seeing exactly what will change first. Works with the open-source edition.

$ metabase-sync plan
  ~ update card 'Orders by date'  collections/main/sales/orders_by_date.yaml
      --- metabase
      +++ collections/main/sales/orders_by_date.yaml
      @@ -8,7 +8,7 @@
             native: |-
      -        SELECT count(*)
      +        SELECT count(*) AS orders
               FROM orders
  + create dashboard 'Q4 review'  collections/main/sales/q4_review.yaml
  - archive card 'Old revenue chart'

Plan: 1 to create, 1 to update, 1 to archive.

Install

uv tool install metabase-sync

Needs Python 3.14 or later and Metabase 0.58 or later. For Metabase 0.55 to 0.57, use metabase-sync 0.3.

Quick start

Create an API key in Metabase (Admin settings > Authentication > API keys) in the Administrators group. Then:

export METABASE_URL=https://metabase.example.com
export METABASE_API_KEY=mb_...

mkdir metabase && cd metabase
metabase-sync init
metabase-sync export

To manage just one collection, use metabase-sync init --collection "Finance".

Usage

Changed something in Metabase? Pull it into the files:

$ metabase-sync export
Updated 2 files (1 added, 1 changed).

Changed the files? Apply them. apply shows what will change and asks first:

$ metabase-sync apply
  + create card 'Revenue by month'  collections/main/sales/revenue_by_month.yaml

Plan: 1 to create.

Apply these changes? [y/N]: y
  + create card 'Revenue by month'

Applied 1 change.

metabase-sync plan shows the same without applying, for reviews and CI.

A new file creates an item. Deleting a file archives the item, unless something that stays still uses it; then plan tells you what.

Changed both? metabase-sync keeps track of what each side changed since the last sync, in metabase-sync.state. Keep that file with the others.

Your files Metabase export apply
unchanged changed takes Metabase's leaves it alone
changed unchanged keeps yours applies yours
changed changed stops stops

--force picks one side for everything: export --force takes Metabase's version, and apply --force takes yours.

metabase-sync status shows where things stand. metabase-sync --help lists every command and option.

Configuration

Set these as environment variables, or in a .env file:

Variable Default
METABASE_URL Required.
METABASE_API_KEY Required, unless METABASE_HEADERS carries the credentials.
METABASE_HEADERS Extra headers as JSON, for example for an auth proxy.
METABASE_TIMEOUT 120 Seconds per request.
METABASE_CONCURRENCY 12 Requests at once.

Optional settings go in metabase-sync.yaml:

Setting Default
collections all Entity ids of the collections to manage. init --collection fills this in.
snippets see below Whether to manage snippets. On when managing everything, off with collections.
removal archive What happens to an item whose file you delete: archive or delete.
unmanaged keep What happens to items added in Metabase inside managed collections: keep, archive, or delete. Anything still in use is kept, and plan says why.

For several Metabase instances, use one folder each and run with --chdir.

CI

examples/ has GitHub Actions workflows to plan on pull requests, apply on merge, and check for changes made in Metabase. Use apply --auto-approve in CI.

Exit code Meaning
0 Success, no changes
1 Error, conflict, or apply declined
2 plan --detailed-exitcode or export --check found changes
130 Interrupted

Good to know

  • apply never overwrites a change made in Metabase without --force.
  • An interrupted export or apply is safe to run again.
  • A plan saved with plan --out won't apply if anything changed since.
  • Not managed: permissions, users, groups, alerts, segments, legacy metrics, public links, personal collections, and the questions inside documents.
  • Upgrading from 0.3: export into a new folder and replace the old files.

Contributing

See CONTRIBUTING.md.

License

MIT. Not affiliated with Metabase, Inc.

Metadata

Release files for metabase-sync 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for metabase-sync 0.4.2
File Size Uploaded Provenance Actions
metabase_sync-0.4.2.tar.gz 98.1 kB With provenance Details for metabase_sync-0.4.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for metabase-sync 0.4.2
File Interpreter ABI Platform Actions
metabase_sync-0.4.2-py3-none-any.whl Python 3 none any Details for metabase_sync-0.4.2-py3-none-any.whl

Total release size: 170.8 kB

Release files / metabase_sync-0.4.2.tar.gz

Download URL metabase_sync-0.4.2.tar.gz
Size 98.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6e558036c2516958ca996a1b230039a281138cf99e26d1b83531328a32321688
BLAKE2b-256 checksum
How to use checksums
5ec4200bfaa82b6312870c69a615ea2adb2924a954b117ed3d93e5537c9174dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / metabase_sync-0.4.2-py3-none-any.whl

Download URL metabase_sync-0.4.2-py3-none-any.whl
Size 72.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98888019af866a380dc0b107fa9b9005b4267584758412209559281896a48923
BLAKE2b-256 checksum
How to use checksums
07f6b29fdb7c5d03a1cd1f90a234cc0a163684a05b8a1f3515929af9b83eabd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Security for metabase-sync 0.4.2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for metabase_sync-0.4.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

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.

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