A Python module for working with Metabase
Project description
Metabase Mate
The Mate
class in this Python module provides a convenient interface for interacting with Metabase, an open-source business intelligence tool. With this module, you can perform various tasks such as establishing connections, retrieving user information, managing table and field mappings, and duplicating dashboards.
Features
-
Connection Handling: The
Mate
class allows you to establish and maintain connections with the Metabase API by providing methods for setting and updating the API URL and session ID. -
User Interaction: You can interact with the Metabase API to retrieve user information, such as the current user's name and email address.
-
Table and Field Mapping: The module enables you to map database names, table names, and field names to their corresponding IDs in Metabase, facilitating easier querying and manipulation of data.
-
Dashboard Duplication: You can duplicate existing dashboards within Metabase, specifying the destination collection and optionally providing a new name for the duplicated dashboard.
Usage
To utilize the functionalities provided by the Mate
class, follow these steps:
-
Initialization: Create an instance of the
Mate
class, optionally providing the Metabase API URL and session ID.mate = Mate(metabase_api_url="https://example.com/metabase", session_id="your_session_id")
-
Connection Establishment: Upon initialization, the module attempts to establish a connection with Metabase using the provided credentials. If successful, it prints a welcome message.
-
Table and Field Mapping: The module automatically loads and updates mappings between database names, table names, and field names and their corresponding IDs in Metabase.
-
Dashboard Duplication: You can duplicate existing dashboards by providing the dashboard ID and the ID of the destination collection. Optionally, you can specify a new name for the duplicated dashboard.
mate.duplicate_dashboard(dashboard_id=123, new_collection_id=456, new_dashboard_name="New Dashboard Name")
-
Session ID Update: If necessary, you can update the session ID used for authentication with the Metabase API.
mate.update_session_id("new_session_id")
Requirements
- Python 3.x
requests
module
Installation
Ensure you have the requests
module installed. You can install it via pip:
pip install requests
Conclusion
The Mate
class simplifies interactions with the Metabase API, providing a Pythonic interface for managing connections, querying metadata, and performing administrative tasks such as dashboard duplication. With its intuitive methods and error handling, it streamlines the development of applications that integrate with Metabase.
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
File details
Details for the file metabase-mate-4.0.0.tar.gz
.
File metadata
- Download URL: metabase-mate-4.0.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3aa3d120033a3bc512f33fae6e6c0c9d3216ae031a3657f0f45e293eb5812ed3 |
|
MD5 | 42726ece75f15500e0fe7626d06d34d0 |
|
BLAKE2b-256 | 68d3b69b8346fdc8e57263e575f5037d11ca3e53edf7f58e38fee836c3208d32 |