Metabase

The Metabase integration synchronizes your Metabase Question metadata into the lineage graph. In this way you can quickly identify which data is being used by your BI tools, which data is not, and more.

Web App

Metabase Integration Homescreen

Fields

FieldValueExample
sourceThe name of the source, see sourcesmy-source
NameName for connectionMetabase
NamespaceNamespace for the connection, see namespacedefault
usernameUsername for an authorized Metabase User
passwordPassword of the authorized user
namespacesAn Optional JSON string (see below)
endpointEndpoint of your Metabase instancemetabase.yourdomain.com

Namespaces

ℹī¸

If the namespaces field is not provided, Grai will create a default namespace for each databases on your behalf. You can always update the namespaces field later to customize your namespace organization.

Metabase stores a database id for every database it's configured to query from. In order to automatically tie your data lineage together, Grai needs to know which Grai namespace corresponds to each database id. The namespaces field should be a JSON string with the Grai namespace for each database id e.g.

{
    "<database_id>": "<namespace>"
}

Python Library

The Metabase integration can be run as a standalone python library to extract data lineage from your instance of Metabase.

The library is available via pip

pip install grai_source_metabase

More information about the API is available here.

Example

The library is split into a few distinct functions but if you only wish to extract nodes/edges you can do so as follows:

  from grai_source_metabase import MetabaseIntegration
  from grai_schemas.v1.source import SourceV1
 
  source = SourceV1(name="my-source", type="my-type")
  metabase_params = {
    "username": "my-username",
    "password": "my-password",
    "endpoint": "https://metabase.yourdomain.com"
  }
 
  integration = MetabaseIntegration(source=source, namespace="metabase", **metabase_params)
 
  nodes, edges = integration.get_nodes_and_edges()