{"id":19756376,"url":"https://github.com/mara/mara-metabase","last_synced_at":"2025-04-30T11:33:27.349Z","repository":{"id":41198415,"uuid":"276612814","full_name":"mara/mara-metabase","owner":"mara","description":"Configuration and schema sync for Metabase from Python","archived":false,"fork":false,"pushed_at":"2023-03-23T20:35:31.000Z","size":2166,"stargazers_count":19,"open_issues_count":3,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-15T17:45:55.847Z","etag":null,"topics":["data-governance","mara","metabase","metabase-python","metadata","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mara.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-02T10:07:14.000Z","updated_at":"2023-05-04T20:10:35.000Z","dependencies_parsed_at":"2022-09-26T17:20:42.097Z","dependency_job_id":null,"html_url":"https://github.com/mara/mara-metabase","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mara%2Fmara-metabase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mara%2Fmara-metabase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mara%2Fmara-metabase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mara%2Fmara-metabase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mara","download_url":"https://codeload.github.com/mara/mara-metabase/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251691617,"owners_count":21628356,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-governance","mara","metabase","metabase-python","metadata","python"],"created_at":"2024-11-12T03:15:43.834Z","updated_at":"2025-04-30T11:33:25.153Z","avatar_url":"https://github.com/mara.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mara Metabase\n\n[![Build Status](https://travis-ci.org/mara/mara-metabase.svg?branch=master)](https://travis-ci.org/mara/mara-metabase)\n[![PyPI - License](https://img.shields.io/pypi/l/mara-metabase.svg)](https://github.com/mara/mara-metabase/blob/master/LICENSE)\n[![PyPI version](https://badge.fury.io/py/mara-metabase.svg)](https://badge.fury.io/py/mara-metabase)\n[![Slack Status](https://img.shields.io/badge/slack-join_chat-white.svg?logo=slack\u0026style=social)](https://communityinviter.com/apps/mara-users/public-invite)\n\n\nAutomating the setup and configuration of Metabase instances. Comes with\n\n- Functions for adding users, databases \u0026 settings\n\n- Syncing of field descriptions and metrics defined with [Mara Schema](https://github.com/mara/mara-schema) to Metabase\n\n- Syncing of users and permissions to Metabase\n\n- A Makefile for running Metabase locally\n\n\n\u0026nbsp;\n\n## Installation\n\nTo use the library directly, use pip:\n\n```\npip install mara-metabase\n```\n\nor\n\n```\npip install -e git+https://github.com/mara/mara-metabase.git\n```\n\nFor an example of an integration into a flask application, have a look at the [mara example project 1](https://github.com/mara/mara-example-project-1).\n\n\n\u0026nbsp;\n\n## Running Metabase\n\nFrom within a project, include [https://github.com/mara/mara-metabase/tree/master/.scripts/metabase.mk] in your project Makefile (as for example in [https://github.com/mara/mara-example-project-1/blob/master/Makefile](https://github.com/mara/mara-example-project-1/blob/master/Makefile)).\n\nRunning `make setup-metabase` will download a Metabase jar file, run database migrations, add an admin user \u0026 create a database connection to the data warehouse. Then, running `make run-metabase` will start Metabase on port 3000:\n\n![Metabase](docs/metabase.png)\n\nYou can log in with the default username `admin@my-company.com` and the password `123abc` (configurable via [mara_metabase/config.py](https://github.com/mara/mara-metabase/tree/master/mara_metabase/config.py), please change in production).\n\nFor running Metabase in production, please have a look at [https://www.metabase.com/docs/latest/operations-guide/installing-metabase.html](https://www.metabase.com/docs/latest/operations-guide/installing-metabase.html).\n\n\u0026nbsp;\n\n## Features\n\n### Programatically setting up Metabase\n\nThe file [mara_metabase/setup.py](https://github.com/mara/mara-metabase/tree/master/mara_metabase/setup.py) contains functions for configuring a Metabase instance by directly writing to its metadata database (rather than manually configuring an instance through the UI). These functions are particularly useful when multiple Metabase instances are maintained (e.g. one for each testing / staging environment).\n\nThere is a flask cli command for running the `setup` function: `flask mara_metabase.setup`.\n\n**Danger: this will remove any other configured database connections from metabase!**\n\n\u0026nbsp;\n\n### Metadata sync\n\nIf you have a data warehouse schema defined in [Mara Schema](https://github.com/mara/mara-schema), then you can automatically sync field descriptions and metric definitions with the `update_metadata` function in [mara_metabase/metadata.py](https://github.com/mara/mara-metabase/tree/master/mara_metabase/metadata.py).\n\nHere's an example of an automatically synced definition for the metric average order value:\n\n![Metabae metadata sync](docs/metabase-metadata-sync.png)\n\nThis function assumes that all reporting tables were created using the sql-generation features of Mara Schema.\n\nThe schema sync can be triggered manually with `flask mara_metabase.update-metadata`.\n\nHave a look at [https://github.com/mara/mara-example-project-1/blob/master/app/pipelines/update_frontends/\\_\\_init\\_\\_.py](https://github.com/mara/mara-example-project-1/blob/master/app/pipelines/update_frontends/__init__.py) for how to integrate schema sync into a data pipeline.\n\n\u0026nbsp;\n\n\n## Syncing of users, groups \u0026 permissions from [Mara ACL](https://github.com/mara/mara-acl)\n\nOnce you add the Metabase ACL resource in [mara_metabase/views.py](https://github.com/mara/mara-metabase/tree/master/mara_metabase/views.py) to your project, you can easily control which users can query which data set:\n\n![Metabase ACL](docs/mara-acl.png)\n\nThe sync must be explicitly enabled in your setup code to not interfere with a metabase instance which has its own user management:\n\n```python\n# e.g. in app/ui/__init__.py\nimport mara_metabase.acl\nmara_metabase.acl.enable_automatic_sync_of_users_and_permissions_to_metabase()\n```\n\n**Danger: Enabling this feature will overwrite any existing users, groups \u0026 permissions in Metabase**\n\n\nAfter enabling, all users in Mara ACL will be synced to Metabase together with their respective groups on \"Save\" of the permissions. Permissions in Metabase can be given for all or for individual data sets.\n\n\nIn this example, users from the \"Management\" group can query all data sets, and users from \"Marketing\" only \"Customers\" and \"Leads\" (with the exception of Thomas who can also query \"Order items\" and \"Sellers\").\n\nThis is the same data in the Metabase admin UI:\n\n![Metabase permissions](docs/metabase-permissions.png)\n\n\n\u0026nbsp;\n\nThe easiest way to try out Mara Metabase is to run the [mara example project 1](https://github.com/mara/mara-example-project-1).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmara%2Fmara-metabase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmara%2Fmara-metabase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmara%2Fmara-metabase/lists"}