Skip to main content

Documentation index: llms.txt. This page is also available as markdown: append .md to this URL or send Accept: text/markdown.

Metabase

Extract Metabase metadata into Catalog using the castor-extractor package. The package supports Postgres and API connectors.

Prerequisites​

Installation Required

Follow the castor-extractor installation instructions before running the extraction.

The package currently supports two connectors:

Postgres​

The data is extracted by running SQL queries on the Postgres database used by your Metabase instance:

  • Directly on your Metabase DB
  • On a replica or views with similar structure

You will need Postgres credentials with read access on Metabase tables (or views with similar columns)

Metabase API​

The data is extracted by calling the Metabase API.

Prerequisites:

  • Metabase credentials with role superuser
Popularity Not Available

This connector does not allow computing popularity, since the activity endpoint brings partial results.

Run Extraction Script​

Once the package has been installed, you should be able to run the following command in your terminal:

castor-extract-metabase-db [arguments]

# or, if you use the API connector:
castor-extract-metabase-api [arguments]

The script will run and display logs as following:

INFO - Getting session_id: {'id': '****'}
INFO - Fetching USER (15 results)
INFO - Wrote output file: /tmp/catalog/1649081473-user.json
INFO - Fetching COLLECTION (41 results)

...

INFO - Wrote output file: /tmp/catalog/1649081473-dashboard_cards.json
INFO - Wrote output file: /tmp/catalog/1649081473-summary.json

Credentials​

You can sign-in using one of the following methods:

  • with Postgres connector
    • -H, --host: Host name where the server is running
    • -P, --port: TCP/IP port number
    • -d, --database: Database name
    • -s, --schema: Schema name where the views or tables are located
    • -u, --user: User
    • -p, --password: Password
    • -o, --output: Directory to write to
  • with API connector
    • -b, --base-url: Metabase base URL, such as http://company.cloud.metabase.com
    • -u, --user: Metabase user
    • -p, --password: Metabase password

Other Arguments​

  • -o, --output: Target folder to store the extracted files
Help

You can also get help with the --help argument.

Use ENV Variables​

If you don't want to specify arguments every time, you can set the following ENV in your .bashrc:

# with DB connector #
CASTOR_METABASE_DB_HOST
CASTOR_METABASE_DB_PORT
CASTOR_METABASE_DB_DATABASE
CASTOR_METABASE_DB_SCHEMA
CASTOR_METABASE_DB_USERNAME
CASTOR_METABASE_DB_PASSWORD

# with API connector #

CASTOR_METABASE_API_BASE_URL
CASTOR_METABASE_API_USERNAME
CASTOR_METABASE_API_PASSWORD

# optional, valid with both connectors #

CASTOR_METABASE_ENCRYPTION_SECRET_KEY

CASTOR_OUTPUT_DIRECTORY

Then the script can be executed without any arguments:

castor-extract-metabase-db

It can also be executed with partial arguments (the script looks in your ENV as a fallback):

castor-extract-metabase-db --output /tmp/catalog