Metabase

Prerequisites

To connect Metabase as a data source in Zenskar, ensure the following:

Authentication

To set up a Metabase data source connector in Zenskar, you need:

  • Username and password: Used to generate a new session token

  • Session token: A token used to authenticate API requests (typically expires every 14 days)

ℹ️

If you provide only username and password, Zenskar will generate a session token automatically when running queries. This may trigger security notifications in the user's Metabase account.

Metabase API URL
  • The URL of your Metabase instance API (must use https://)
  • Example: https://your-metabase-domain.com/api/
Obtain a session token (optional)

You can manually generate a session token using Metabase’s API:

curl -X POST \
-H "Content-Type: application/json" \
-d '{"username": "[email protected]", "password": "fakepassword"}' \
https://your-metabase-domain.com/api/session

The response includes an id field — this is your session_token:

{"id":"38f4939c-ad7f-4cbe-ae54-30946daf8593"}
🚧

Expiration of session tokens

Session tokens expire (14 days by default). Update it in Zenskar when expired or configure your Metabase server’s MAX_SESSION_AGE environment variable to extend the session duration.

❗️

Invalid or expired session token errors

The connector will alert you of an invalid or expired session token by returning a 401 Unauthorized response status code.


Set up a Metabase data-source connector via Zenskar dashboard

Once the prerequisites are complete, connect Metabase as a data source in Zenskar.

  1. Log into your Zenskar dashboard.
  2. In the left side bar, click Usage > Data Sources.
  3. In the top-right corner, click + ADD DATA SOURCE.
  4. On the Add New Data Source page, configure the Metabase connector
General details
FieldDescriptionRequired
Source NameEnter a unique name for this data source.Yes
Source TypeSelect Metabase from the dropdown menu.Yes
Connector configuration
FieldDescriptionRequired
Metabase instance API URLURL to your Metabase instance API. Must start with https://. Example: "https://localhost:3000/api/"Yes
UsernameUsername for authenticating with MetabaseYes
PasswordPassword for authenticating with MetabaseYes
Session tokenSession token for Metabase authenticationYes
Data source access mode (read-only)

Zenskar replicates data directly from your Metabase instance to Zenskar’s data infrastructure. The data is periodically synced to maintain freshness. This option is:

  • Ideal for small-mid size database (less than 30GB)
  • Ideal for periodical data ingestion
  • Optimised for quicker invoice generation
  1. Click on the SAVE SOURCE button

Addendum

Supported streams

Refer to the Metabase API reference.

StreamDescription
CardExport cards (questions) from Metabase
CollectionsExport collection metadata
DashboardExport dashboards and metadata
UserExport user information
DatabasesExport database metadata
Native Query SnippetExport SQL snippets saved in Metabase
Data-type mapping
Metabase typeZenskar type
stringstring
integer, numbernumber
arrayarray
objectobject