A Python client for duplicating Metabase dashboard for multi schemas
Project description
Multi Schema Metabase Dashboard Helper
This Python package provides a convenient interface for interacting with the Metabase API to automate tasks such as copying and updating dashboards based on different schemas.
Requirements
- Python 3.x
- requests library
Installation
To use this package, you can install it via pip:
pip install multischema-metabase-dashboard-helper
Usage
--> IMPORTANT NOTE <--
You need to convert all the questions (cards) in the dashboard to sql before being able to use this to change the schema dynamically
Create dashboards Per topic
update_dashboards_for_schemas: Duplicates a template dashboard across multiple schemas, ensuring each schema has a centralized dashboard that includes all card topics. This helps in maintaining a consistent dashboard layout across different schemas, with each schema's data displayed in a similar manner. Update dashboards for different schemas
Using the GUI:
- create a dashboard with one of the schemas you have available it will be used as the template schema.
- include in this dashboard all the cards(questions) that you need to apply to the other schemas. (this is the from_dashboard_id that we will use in the script).
old_schema field is the name of the schema that you choose as the template schema
from metabase_api.metabase_api.api_client import MetabaseAPIClient
# Set up API credentials and parameters
api_url = "https://metabase.example.com"
username = "your_username"
password = "your_password"
database_id = 2
from_dashboard_id = 8 # Replace with the actual dashboard ID
collection_id = 130 # Replace with the actual collection ID where you want to place the copied dashboard
collection_position = 1
is_deep_copy = True
old_schema = "template_schema_name"
# Initialize the Metabase API client
api_client = MetabaseAPIClient(api_url, username, password, database_id)
api_client.update_dashboards_for_schemas(from_dashboard_id, collection_id, collection_position, is_deep_copy, old_schema)
Create dashboards Per topic
create_dashboards_for_topics: Creates new dashboards for each card topic, consolidating all cards related to that topic into one dashboard per topic. This helps in organizing and visualizing data specific to each topic within a single dashboard.
from metabase_api.metabase_api.api_client import MetabaseAPIClient
# Set up API credentials and parameters
api_url = "https://metabase.example.com"
username = "your_username"
password = "your_password"
database_id = 2
collection_id = 130 # Replace with the collection ID where you want to get the cards
# Initialize the Metabase API client
api_client = MetabaseAPIClient(api_url, username, password, database_id)
cards = api_client.get_cards_in_collection(collection_id)
if cards:
api_client.create_dashboards_for_topics(cards)
Documentation
For detailed information about the methods and parameters provided by the MetabaseAPIClient, please refer to the source code comments and docstrings within the metabase_api package.
Note
- Ensure that you replace placeholder values such as
api_url,username,password,database_id,from_dashboard_id,collection_id,collection_position, andold_schemawith your actual Metabase API credentials and parameters. - This package assumes familiarity with the Metabase API and its endpoints. Refer to the official Metabase API documentation for more information on available endpoints and their usage.
Disclaimer
This package is provided as-is without any warranty.
metabase-multi-schema-dashboard-duplicator
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file multischema-metabase-dashboard-helper-0.1.4.tar.gz.
File metadata
- Download URL: multischema-metabase-dashboard-helper-0.1.4.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29fa15f65dc14fbf18ecd368e5712daf295e420c303e2a9f6c576f8fa2f4cf92
|
|
| MD5 |
aef01560349793e5628ecdb7b9c7eb7b
|
|
| BLAKE2b-256 |
5a42b6fef2cd82da5d59f3c5a6e8e13ab363d1784ad004c9324154c03702f851
|
File details
Details for the file multischema_metabase_dashboard_helper-0.1.4-py3-none-any.whl.
File metadata
- Download URL: multischema_metabase_dashboard_helper-0.1.4-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
973dba4493947fe98b66ff0bcf0f0a53d4308a54deca247254d1777f9cc2c421
|
|
| MD5 |
abf189954b579035d0f9b536b169d72a
|
|
| BLAKE2b-256 |
1efe4871f9d22cf62032b8399fc483ffe25b98718bd3bc68d87416305806e70f
|