Skip to the content
LeaplogicLeaplogic
  • Home
  • About Us
  • Contact
SIGN IN
  • Home
  • About Us
  • Contact

  • Getting Started
    • Before You Begin
    • Creating an Account
    • Logging into LeapLogic
    • Reset Password
    • Quick Tour of the Web Interface
    • LeapLogic in 15 minutes
      • Prerequisites
      • Step 1. Log into LeapLogic
      • Step 2. Create Assessment and Get Insights
      • Step 3. Create Transformation Pipeline and See Results
      • Step 4. Edit or Optimize the Transformed Code
      • Step 5: Complete the Transformation Lifecycle
  • Introduction to LeapLogic
    • Overview
    • High Level Architecture
    • Supported Legacy and Cloud Platforms
    • Key Features
  • LeapLogic Deployment Architecture & Prerequisites
  • Workload Assessment
    • Overview
    • Value Proposition
    • Creating Assessment
      • Prerequisites
      • Step 1. Provide Primary Inputs
        • Automation Coverage
      • Step 2. Add the Additional Inputs
        • Table Stat Extraction Steps
          • Teradata
          • Oracle
          • Netezza
      • Step 3. Update the Source Configuration
      • Step 4. Configure the Recommendation Settings
    • Assessment Listing
    • Understanding Insights and Recommendations
      • Volumetric Info
      • EDW
        • Oracle
          • Highlights
          • Analysis
          • Optimization
          • Lineage
          • Recommendations
          • Downloadable Reports
        • Vertica
          • Highlights
          • Analysis
          • Optimization
          • Lineage
          • Recommendations
          • Downloadable Reports
        • Snowflake
          • Highlights
          • Analysis
          • Optimization
          • Lineage
          • Recommendations
          • Downloadable Reports
        • Azure Synapse
          • Highlights
          • Analysis
          • Optimization
          • Lineage
          • Recommendations
          • Downloadable Reports
        • SQL Server
          • Highlights
          • Analysis
          • Optimization
          • Lineage
          • Recommendations
          • Downloadable Reports
        • Teradata
          • Highlights
          • Analysis
          • Optimization
          • Lineage
          • Recommendations
          • Downloadable Reports
        • Netezza
          • Highlights
          • Analysis
          • Optimization
          • Lineage
          • Recommendations
          • Downloadable Reports
        • Google Big Query
          • Highlights
          • Analysis
          • Optimization
          • Lineage
          • Recommendations
          • Downloadable Reports
        • Redshift
          • Highlights
          • Analysis
          • Optimization
          • Lineage
          • Recommendations
          • Downloadable Reports
        • PostgreSQL
          • Highlights
          • Analysis
          • Optimization
          • Lineage
          • Recommendations
          • Downloadable Reports
        • Duck DB
          • Highlights
          • Analysis
          • Optimization
          • Lineage
          • Recommendations
          • Downloadable Reports
        • ClickHouse
          • Highlights
          • Analysis
          • Optimization
          • Lineage
          • Recommendations
          • Downloadable Reports
        • Exasol
          • Highlights
          • Analysis
          • Optimization
          • Lineage
          • Recommendations
          • Downloadable Reports
        • DB2
          • Highlights
          • Analysis
          • Optimization
          • Recommendations
          • Lineage
          • Downloadable Reports
      • ETL
        • Informatica
          • Highlights
          • Analysis
          • Lineage
          • Downloadable Reports
        • Ab Initio
          • Highlights
          • Analysis
          • Lineage
          • Downloadable Reports
        • DataStage
          • Highlights
          • Analysis
          • Lineage
          • Downloadable Reports
        • Talend
          • Highlights
          • Analysis
          • Lineage
          • Downloadable Reports
        • SSIS
          • Highlights
          • Analysis
          • Lineage
          • Downloadable Reports
        • Informatica BDM
          • Highlights
          • Analysis
          • Lineage
          • Downloadable Reports
        • Oracle Data Integrator
          • Highlights
          • Analysis
          • Downloadable Reports
        • Pentaho
          • Highlights
          • Analysis
          • Downloadable Reports
        • Azure Data Factory
          • ARM Template
          • Highlights
          • Analysis
          • Downloadable Reports
        • Matillion
          • Highlights
          • Analysis
          • Downloadable Reports
        • SnapLogic
          • Highlights
          • Analysis
          • Downloadable Reports
      • Orchestration
        • AutoSys
          • Highlights
          • Analysis
          • Downloadable Reports
        • Control-M
          • Highlights
          • Analysis
          • Lineage
          • Downloadable Reports
        • SQL Server
          • Highlights
          • Analysis
      • BI
        • OBIEE
          • Highlights
          • Analysis
          • Lineage
          • Downloadable Reports
        • Tableau
          • Highlights
          • Analysis
          • Lineage
          • Downloadable Reports
        • IBM Cognos
          • Highlights
          • Analysis
          • Downloadable Reports
        • MicroStrategy
          • Highlights
          • Analysis
          • Lineage
          • Downloadable Reports
        • Power BI
          • Highlights
          • Analysis
          • Lineage
          • Downloadable Reports
        • SSRS
          • Highlights
          • Analysis
          • Downloadable Reports
        • SAP BO
          • Highlights
          • Analysis
          • Lineage
          • Downloadable Reports
        • WebFOCUS
          • Highlights
          • Analysis
          • Downloadable Reports
      • Analytics
        • SAS
          • Highlight
          • Analysis
          • Lineage
          • Downloadable Reports
        • Alteryx
          • Highlights
          • Analysis
          • Lineage
          • Downloadable Reports
      • Shell
        • Highlights
        • Analysis
        • Lineage
        • Downloadable Reports
      • Integrated Assessment (EDW, ETL, Orchestration, BI)
        • Highlights
        • Analysis
        • Optimization
        • Lineage
        • Recommendations
    • Managing Assessment Reports
      • Downloading Report
      • Input Report Utility
      • View Configuration
    • Complexity Calculation Logic
    • Key Benefits
    • Ad hoc Query
  • Script/ Query Log/ Code Extraction Prerequisites
    • Cloud
      • Azure Data Factory
      • Snowflake
      • Azure Synapse
      • Google BigQuery
      • Redshift
      • Azure SQL Database Hyperscale
      • Aurora PostgreSQL
    • EDW
      • Oracle
      • Netezza
      • Teradata
      • Vertica
      • SQL Server
      • Db2
      • MySQL
      • PostgreSQL
    • ETL
      • DataStage
      • Informatica
      • SSIS
      • Talend
      • ODI
      • IICS
      • DBT
      • Pentaho
      • Matillion
      • SnapLogic
      • Ab Initio
      • SAP BODS
      • TAC
      • WebFOCUS
    • BI
      • IBM Cognos
      • OBIEE
      • Tableau
      • Metabase
      • MicroStrategy
      • PowerBI
      • LeapLogic Utility for SAP BO
      • SAP BO Universe and Web Intelligence
      • SSRS
    • Analytics
      • SAS
      • Alteryx
    • Orchestration
      • AutoSys
      • Control-M
      • SQL Server
    • Mainframe
  • Metadata Management
    • Overview
    • Introduction to Data Catalog
      • Managing Data Catalog
        • Building Data Catalog
        • Insights to Data Catalog
        • Managing the Repository and Data Source
      • Creating Repository (Repo)
      • Creating Data Source
    • Tag Management
    • Key benefits
  • Batch Processing using Pipeline
    • Introduction
    • Designing Pipeline
      • How to create a pipeline
        • Configuring Migration Stage
          • Schema Optimization
        • Configuring Transformation Stage
          • On-premises to Cloud
          • Cloud-to-Cloud
            • Assigning Roles
            • Intelligent Modernization
          • LeapFusion
        • Configuring Validation Stage
          • Data Validation
            • Table
            • File
            • File and Table
            • Cell-by-cell validation
          • Query Validation
            • Query Validation (When Data is Available)
            • Query Validation (When Data is Not Available)
          • Schema Validation
        • Configuring Execution Stage
        • Configuring ETL Conversion Stage
          • Ab Initio
          • Informatica
          • Informatica BDM
          • Matillion
          • DataStage
          • SSIS
          • IICS
          • Talend
          • Oracle Data Integrator
          • Pentaho
          • SnapLogic
        • Configuring Mainframe Conversion Stage
          • Cobol
          • JCL
        • Configuring Orchestration Stage
          • AutoSys
          • Control-M
        • Configuring BI Conversion Stage
          • OBIEE to Power BI
          • OBIEE to AWS QuickSight
          • Tableau to Amazon QuickSight
          • Tableau to Power BI
          • Tableau to Superset
          • Tableau to Looker
          • IBM Cognos to Power BI
        • Configuring Analytics Conversion Stage
          • SAS
          • Alteryx
        • Configuring Script Conversion Stage
    • Key Features
      • How to schedule a pipeline
      • Configuring Parameters
  • Pipeline Reports
    • Overview of Pipeline Report
    • Pipeline Listing
    • Reports and Insights
      • Migration
      • Transformation
        • On-premises to Cloud
        • Cloud-to-Cloud
      • Validation
        • Data
          • File
          • Table
          • File and Table
        • Query
          • Query Validation Report (When Data is Available)
          • Query Validation Report (When Data is not Available)
        • Schema
      • Execution
      • ETL
        • Ab Initio
        • Informatica
        • Informatica BDM
        • Matillion
        • DataStage
        • SSIS
        • IICS
        • Talend
        • Oracle Data Integrator
        • Pentaho
        • SnapLogic
      • Mainframe
        • Cobol
        • JCL
      • Orchestration
        • AutoSys
        • Control-M
      • BI
        • OBIEE to Power BI
        • OBIEE to Amazon QuickSight
        • Tableau to Amazon QuickSight
        • Tableau to Power BI
        • Tableau to Superset
        • Tableau to Looker
        • IBM Cognos to Power BI
      • Analytics
        • SAS
        • Alteryx
      • Shell Script
      • Common Model
    • Automation Level Indicator
      • ETL
        • Informatica
        • Matillion
        • DataStage
        • Informatica BDM
        • SnapLogic
        • IICS
        • Ab Initio
        • SSIS
        • Talend
        • Pentaho
      • Orchestration
        • AutoSys
        • Control-M
      • EDW
      • Analytics
        • SAS
        • Alteryx
      • BI
      • Shell Script
    • Error Specifications & Troubleshooting
  • SQL Transformation
    • Overview
    • Creating and Executing the Online Notebook
      • How to Create and Execute the Notebook
      • Supported Features
    • Configuring the Notebook
      • Transformation
      • Unit Level Validation
      • Script Level Validation
    • Notebook Listing
  • Operationalization
    • Overview
      • Basic
      • Advanced
      • Cron Expression
    • Parallel Run Pipeline Listing
  • Transformation Source
    • Introduction
    • Creating Transformation Source Type
  • Governance
    • Summary of Governance - Roles and Permissions
    • User Creation
      • Creating a new User Account
    • Adding Roles and permissions
      • How to add Roles and Permissions to a new user?
    • Adding Group Accounts
    • Manage Quota
    • Product Usage Metrics
  • License
    • Workload Assessment
    • EDW Conversion
    • ETL Conversion
    • BI Conversion
    • Orchestration Conversion
    • Data Migration
    • Data Validation
  • LeapLogic Desktop Version
    • Overview
    • Registration and Installation
    • Getting Started
    • Creating Assessment
      • ETL
      • DML
      • Procedure
      • Analytics
      • Hadoop
    • Reports and Insights
      • Downloadable Reports
      • Reports for Estimation
    • Logging and Troubleshooting
    • Sample Scripts
    • Desktop vs. Web Version
    • Getting Help
  • LeapLogic (Version 5.0) Deployment
    • System Requirements
    • Prerequisites
    • Deployment
      • Extracting Package
      • Placing License Key
      • Executing Deployment Script
      • Accessing LeapLogic
    • Uploading License
    • Appendix
    • Getting Help
  • Removed Features
    • Configuring File Validation Stage
    • Variable Extractor Stage
      • Variable Extractor Report
    • Configuring Meta Diff Stage
      • Meta Diff
    • Configuring Data Load Stage
      • Data Load
    • Configuring Multi Algo Stage
  • FAQs
  • Tutorial Videos
  • Notice
Home   »  Script/ Query Log/ Code Extraction Prerequisites   »  BI  »  Metabase Extraction Prerequisites

Metabase Extraction Prerequisites

This topic briefs about the Metabase extraction prerequisites.

In This Topic:

  • Introduction
  • Accessing the Metabase Database
  • Identifying Relevant Tables
  • Exporting Questions/Queries
  • Exporting Dashboards
  • Exporting Dashboard Cards
  • Extracting and Formatting JSON Data
  • Automating the Extraction Process
  • Storing the Extracted Data
  • Scheduling Regular Extractions
  • Analyzing the Extracted Data
  • Documenting the Process
  • Getting Help

Download


Introduction

The purpose of this document is to provide detailed instructions to extract questions, queries, reports, and dashboards from Metabase.


Accessing the Metabase Database

Metabase stores its questions, queries, and dashboards in a database. The first step is to access this database.

Command Example (PostgreSQL):

sh

Copy code

psql -h <hostname> -U <username> -d <database_name>


Identifying Relevant Tables

Identify the tables that contain the information you need. Common tables include report_card, report_dashboard, and report_dashboardcard.

Key Tables:

  • report_card: Stores individual questions/queries.
  • report_dashboard: Stores dashboard information.
  • report_dashboardcard: Stores the mapping of cards to dashboards.


Exporting Questions/Queries

Extract data from the report_card table to get questions and queries.

SQL Query Example:

sql

Copy code

COPY (SELECT * FROM report_card) TO ‘/path/to/output/questions.csv’ WITH CSV HEADER;


Exporting Dashboards

Extract data from the report_dashboard table to get dashboard definitions.

SQL Query Example:

sql

Copy code

COPY (SELECT * FROM report_dashboard) TO ‘/path/to/output/dashboards.csv’ WITH CSV HEADER;


Exporting Dashboard Cards

Extract data from the report_dashboardcard table to get the relationships between dashboards and cards.

SQL Query Example:

sql

Copy code

COPY (SELECT * FROM report_dashboardcard) TO ‘/path/to/output/dashboard_cards.csv’ WITH CSV HEADER;


Extracting and Formatting JSON Data

Metabase often stores configurations in JSON format. Parse these JSON fields if needed for analysis.

Python Example:

python

Copy code

import pandas as pd

import json

# Load the exported CSV

df = pd.read_csv(‘/path/to/output/questions.csv’)

# Parse the JSON column

df[‘visualization_settings’] = df[‘visualization_settings’].apply(json.loads)

# Save to a new file if needed

df.to_csv(‘/path/to/output/parsed_questions.csv’, index=False)


Automating the Extraction Process

Use a script to automate the extraction process at regular intervals.

Shell Script Example:

sh

Copy code

#!/bin/bash

PSQL=”psql -h <hostname> -U <username> -d <database_name>”

$PSQL -c “COPY (SELECT * FROM report_card) TO ‘/path/to/output/questions.csv’ WITH CSV HEADER;”

$PSQL -c “COPY (SELECT * FROM report_dashboard) TO ‘/path/to/output/dashboards.csv’ WITH CSV HEADER;”

$PSQL -c “COPY (SELECT * FROM report_dashboardcard) TO ‘/path/to/output/dashboard_cards.csv’ WITH CSV HEADER;”


Storing the Extracted Data

Store the extracted files in a location where they can be accessed for further analysis such as a data warehouse, local directory, or cloud storage service.


Scheduling Regular Extractions

Use a job scheduler like cron to run your extraction script at regular intervals.

Cron Job Example:

sh

Copy code 0 0 * * * /path/to/extraction_script.sh


Analyzing the Extracted Data

Use data analysis tools (like Python, R, SQL, etc.) to parse and analyze the extracted data files as per your requirements.


Documenting the Process

Document the extraction process including scripts and commands used for future reference and reproducibility.

By following these steps, you can effectively extract Metabase questions, queries, reports, and dashboards into readable and analyzable files.

Steps to Extract Metabase Questions, Queries, Reports, and Dashboards

  1. Prepare the Environment
    1. Ensure you have access to the Metabase instance.
    2. Verify that you have the necessary permissions to access and extract data.
    3. Install any required dependencies, such as Metabase’s API client libraries if needed.
  1. Access the Metabase API
    1. Metabase provides a REST API for accessing various elements. You can use tools like curl, Postman, or any programming language with HTTP capabilities.
    2. Obtain your Metabase API key or set up a session to authenticate requests.

    bash

    Copy code

    # Example using curl to authenticate and obtain a session token

    curl -X POST \

     -H “Content-Type: application/json” \

     -d ‘{“username”: “your_username”, “password”: “your_password”}’ \  http://your-metabase-instance/api/session

  1. Extract Questions
    1. Use the API endpoint to fetch questions. Questions in Metabase are equivalent to saved queries.

    bash

    Copy code

    # Example to get all questions

    curl -X GET \

      -H “Content-Type: application/json” \

      -H “X-Metabase-Session: your_session_token” \   http://your-metabase-instance/api/card

  1. Extract Queries
    1. Extracting queries involves fetching the raw SQL (if applicable) or query details from the questions.

    bash

    Copy code

    # Example to get the raw SQL of a question

    curl -X GET \

      -H “Content-Type: application/json” \

      -H “X-Metabase-Session: your_session_token” \   http://your-metabase-instance/api/card/:card-id/query

  1. Extract Reports (Dashboards)
    1. Dashboards in Metabase are collections of questions displayed together.

    bash

    Copy code

    # Example to get all dashboards

    curl -X GET \

      -H “Content-Type: application/json” \

      -H “X-Metabase-Session: your_session_token” \   http://your-metabase-instance/api/dashboard

  1. Extract Dashboard Details
    1. For detailed information on each dashboard, including the questions.

    bash

    Copy code

    # Example to get details of a specific dashboard

    curl -X GET \

      -H “Content-Type: application/json” \

      -H “X-Metabase-Session: your_session_token” \http://your-metabase-instance/api/dashboard/:dashboard-id

  1. Process and Store Extracted Data
    1. Store the extracted data in a preferred format (JSON, CSV, etc.) for further use.

    python

    Copy code

    # Example using Python to save the response as JSON

    import requests

    import json

    session_token = ‘your_session_token’

    headers = {

     ‘Content-Type’: ‘application/json’,

      ‘X-Metabase-Session’: session_token

    }

    response = requests.get(‘http://your-metabase-instance/api/card’, headers=headers)

    questions = response.json()

    with open(‘metabase_questions.json’, ‘w’) as f:     json.dump(questions, f)

  1. Automate the Extraction (Optional)
    1. To schedule this process, automate it using a script or a cron job.

    Example Commands Summary

    • Authenticate and get session token:

    bash

    Copy code curl -X POST -H “Content-Type: application/json” -d ‘{“username”: “your_username”, “password”: “your_password”}’ http://your-metabase-instance/api/session

    • Get all questions:

    bash

    Copy code curl -X GET -H “Content-Type: application/json” -H “X-Metabase-Session: your_session_token” http://your-metabase-instance/api/card

    • Get raw SQL of a question:

    bash

    Copy code curl -X GET -H “Content-Type: application/json” -H “X-Metabase-Session: your_session_token” http://your-metabase-instance/api/card/:card-id/query

    • Get all dashboards:

    bash

    Copy code curl -X GET -H “Content-Type: application/json” -H “X-Metabase-Session: your_session_token” http://your-metabase-instance/api/dashboard

    • Get details of a specific dashboard:

    bash

    Copy code curl -X GET -H “Content-Type: application/json” -H “X-Metabase-Session: your_session_token” http://your-metabase-instance/api/dashboard/:dashboard-id

    By following these steps, you can systematically extract questions, queries, reports, and dashboards from Metabase.


    Getting Help

    Contact LeapLogic technical support at info@leaplogic.io


    To learn more, contact our support team or write to: info@leaplogic.io

    Copyright © 2025 Impetus Technologies Inc. All Rights Reserved

    • Terms of Use
    • Privacy Policy
    • License Agreement
    To the top ↑ Up ↑