1. Overview
Metabase is an open-source business intelligence and data visualization tool that allows users to ask questions about their data and displays answers in formats that make sense, whether that's a bar graph or a detailed table.
With the GoInsight Metabase node, you can seamlessly integrate your data analytics and management tasks into your automated workflows. This allows you to programmatically interact with your Metabase instance to manage data sources, retrieve insights, and monitor alerts. Key capabilities include:
- Database Management: Add new data sources and list all existing databases connected to your Metabase instance.
- Question & Insight Retrieval: Fetch lists of all saved questions (cards), get details for a specific question, and execute a question to retrieve its results in various formats.
- Alert Monitoring: List all configured alerts or get the details for a single, specific alert.
2. Prerequisites
Before using this node, you need to have a valid Metabase account with access to its API. Depending on the operations you want to perform, you may need administrator or specific permissions to create and manage API credentials.
3. Credentials
For a detailed guide on how to obtain and configure your credentials, please refer to our official documentation: Credentials Configuration Guide.
4. Supported Operations
Summary
This node provides operations centered around managing and retrieving data from your Metabase resources, such as Databases, Questions, and Alerts. The table below summarizes the available actions.
| Resource | Operation | Description |
|---|---|---|
| Alert | Get an Alert | Get specific alert. |
| Alert | Get Many Alerts | Get many alerts. |
| Database | Add a Databases | Add a new datasource to the metabase instance. |
| Database | Get Many Databases | Get many databases. |
| Database Field | Get Fields a Databases | Get fields from database. |
| Question | Get a Questions | Get a specific question. |
| Question | Get Many Questions | Get many questions. |
| Question Result | Get the Results From a Question | Return the result of the question to a specific file format. |
Operation Details
Add a Databases
Add a new datasource to the metabase instance.
Input Parameters:
- Engine: Database engine type, e.g., "redshift", "postgres", "mysql", etc.
- Name: Display name for the database in Metabase.
- Details: Database settting detail,(e.g., {"host": "dw.example.com","port": 5432,"db": "sales_dw","user": "metabase_user","password": "secure_pass_123","ssl": True}).
Output:
- Database (object): Details of the created database object, including id, engine, name, details, etc.
- StatusCode (number): Operation result code: 200 indicates success, -1 indicates parameter error, 500 indicates exception, other values correspond to actual HTTP status codes.
- ErrorMessage (string): Error message; empty string if successful.
Get Fields a Databases
Get fields from database.
Input Parameters:
- DbId: The ID of the database.
Output:
- Fields (object-array): List of field objects.
- StatusCode (number): Operation result code: 200 indicates success, -1 indicates parameter error, 500 indicates exception, other values correspond to actual HTTP status codes.
- ErrorMessage (string): Error message; empty string if successful.
Get Many Alerts
Get many alerts.
Output:
- Alerts (object-array): List of alert objects.
- StatusCode (number): Operation result code: 200 for success, -1 for parameter error, 500 for exception, etc.
- ErrorMessage (string): Error message; empty string if successful.
Get Many Databases
Get many databases.
Output:
- Databases (object-array): List of database objects.
- StatusCode (number): Operation result code: 200 indicates success, -1 indicates parameter error, 500 indicates exception, other values correspond to actual HTTP status codes.
- ErrorMessage (string): Error message; empty string if successful.
Get Many Questions
Get many questions.
Output:
- Cards (object-array): List of card objects.
- StatusCode (number): Operation result code: 200 indicates success, -1 indicates parameter error, 500 indicates exception, other values correspond to actual HTTP status codes.
- ErrorMessage (string): Error message; empty string if successful.
Get a Questions
Get a specific question.
Input Parameters:
- QuestionId: The ID of the question.
Output:
- Question (object): Details of the fetched metric object.
- StatusCode (number): Operation result code: 200 indicates success, -1 indicates parameter error, 500 indicates exception, other values correspond to actual HTTP status codes.
- ErrorMessage (string): Error message; empty string if successful.
Get an Alert
Get specific alert.
Input Parameters:
- AlertId: Alert ID.
Output:
- Alert (object): Alert objects.
- StatusCode (number): Operation result code: 200 for success, -1 for parameter error, 500 for exception, etc.
- ErrorMessage (string): Error message; empty string if successful.
Get the Results From a Question
Return the result of the question to a specific file format.
Input Parameters:
- QuestionId: Question ID.
Options:
- Format: Ouput data format (e.g., csv,json,xlsx).
Output:
- Data (string): The JSON data returned by the question query.
- StatusCode (number): Operation result code: 200 for success, -1 for parameter error, 500 for exception, other values correspond to HTTP status codes.
- ErrorMessage (string): Error message if any, empty if successful.
5. Example Usage
This section will guide you through creating a simple workflow to list all connected databases in your Metabase instance.
The workflow will consist of three nodes: Start -> Metabase: Get Many Databases -> Answer.
- Add the Metabase Node
- In the workflow canvas, click the "+" button to add a new node.
- Select the "Tools" tab in the pop-up panel.
- Find and select "Metabase" from the list of tools.
- In the list of supported operations for Metabase, click on "Get Many Databases" to add the node to your canvas.
- Configure the Node
- Click on the newly added "Get Many Databases" node to open its configuration panel on the right.
- Credentials: In the credentials field at the top of the panel, click the dropdown menu and select your pre-configured Metabase credentials.
- Parameters: This specific operation does not require any input parameters. It will fetch all databases accessible by the provided credentials.
- Run and Validate
- Once the credentials are set, any error indicators on the workflow canvas should disappear.
- Click the "Run" button in the top-right corner of the canvas to execute the workflow.
- After a successful execution, you can click the log icon in the top-right corner to view the detailed inputs and outputs of the node, confirming that the operation was successful and inspecting the list of databases returned.
After completing these steps, your workflow is fully configured. When executed, it will retrieve a complete list of all databases from your Metabase instance, which you can then use in subsequent workflow steps.
6. FAQs
Q: Why am I getting a 401 Unauthorized or 403 Forbidden error?
A: This typically indicates an issue with your credentials or permissions. Please check the following:
- Correct Credentials: Ensure that the API key, username, and password used in your GoInsight credentials configuration are correct and have not expired.
- Sufficient Permissions: The user associated with the credentials must have the necessary permissions within Metabase to perform the desired action (e.g., view databases, run queries).
Q: How do I find the DbId or QuestionId required for other operations?
A: You can use other operations within this node to discover these IDs.
- To find a DbId, use the Get Many Databases operation. The output will be a list of all database objects, each containing its unique id.
- To find a QuestionId, use the Get Many Questions operation. The output will be a list of all question objects (cards), each with its own id.
Q: The Details parameter for the Add a Databases operation is confusing. How should I format it?
A: The Details parameter requires a JSON string that contains all the connection information for the new database. The exact fields required will vary depending on the database Engine you are using. For example, for a PostgreSQL database, the format would be a single-line string like this:
"{\"host\": \"dw.example.com\",\"port\": 5432,\"db\": \"sales_dw\",\"user\": \"metabase_user\",\"password\": \"secure_pass_123\",\"ssl\": true}"
7. Official Documentation
For more in-depth information about the Metabase API and its capabilities, please refer to the Metabase Official API Documentation.
Leave a Reply.