dbt-metabase
raw JSON → 1.7.4 verified Mon Apr 27 auth: no python
A dbt package that synchronizes dbt models and exposures with Metabase, automatically creating and updating Metabase models, metrics, and dashboards. Current version 1.7.4, requires Python >=3.10. Released about monthly.
pip install dbt-metabase Common errors
error KeyError: 'metabase_database_id' ↓
cause Missing required parameter when Metabase has multiple databases.
fix
Add
metabase_database_id=<your_db_id> to the MetabaseSetup constructor. error ImportError: cannot import name 'MetabaseSetup' from 'dbt_metabase' ↓
cause Using an outdated version or wrong import path.
fix
Run
pip install --upgrade dbt-metabase and import using from dbt_metabase import MetabaseSetup. error urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=3000) ↓
cause Metabase server is not running or URL is misconfigured.
fix
Start Metabase or update
metabase_url to point to the correct server. Warnings
breaking v1.7.0 upgraded to Python >=3.10; drop Python 3.9 support. ↓
fix Upgrade your Python runtime to 3.10 or later.
gotcha The `metabase_database_id` parameter is required unless Metabase has only one database with matching name. ↓
fix Provide the correct Metabase database ID via `metabase_database_id` or set it in the profile.
deprecated v1.6.0 deprecated the old `meta` structure; dbt 1.10+ moved meta to config block. ↓
fix Ensure your dbt models use the new config.meta syntax (https://docs.getdbt.com/reference/resource-configs/meta).
breaking v1.7.0 removed support for Python 3.9; older Python versions may fail with import errors. ↓
fix Check your Python version with `python --version` and upgrade if needed.
Imports
- MetabaseSetup
from dbt_metabase import MetabaseSetup
Quickstart
from dbt_metabase import MetabaseSetup
setup = MetabaseSetup(
metabase_url=os.environ.get('MB_URL', 'http://localhost:3000'),
metabase_username=os.environ.get('MB_USER', 'admin@example.com'),
metabase_password=os.environ.get('MB_PASSWORD', 'password'),
dbt_project_dir='./my_dbt_project',
metabase_database_id=1
)
exposures = setup.sync(
include_tags=['metabase'],
exclude_models=['stg_*']
)