Skip to main content

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:

  1. 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")
    
  2. Connection Establishment: Upon initialization, the module attempts to establish a connection with Metabase using the provided credentials. If successful, it prints a welcome message.

  3. 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.

  4. 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")
    
  5. 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.

Metadata

Release files for metabase-mate 4.0.0

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-mate 4.0.0
File Size Uploaded
metabase-mate-4.0.0.tar.gz 4.6 kB Details

Release files / metabase-mate-4.0.0.tar.gz

Download URL metabase-mate-4.0.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3aa3d120033a3bc512f33fae6e6c0c9d3216ae031a3657f0f45e293eb5812ed3
BLAKE2b-256 checksum
How to use checksums
68d3b69b8346fdc8e57263e575f5037d11ca3e53edf7f58e38fee836c3208d32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release history Release notifications | RSS feed

This release

4.0.0 This release

1 release file

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