DataLab Docs
  • What is DataLab?
  • Work
    • Creating a workbook
    • Sharing a workbook
    • Managing a workbook
    • Code cell
      • Working with packages
    • Text cell
      • Including images
    • SQL cell
      • SQL scenarios
      • Parameterize your SQL query
    • Explore Data cell
    • Chart cell
      • Configuring your chart
      • Pivot charts
      • Migration guide
    • AI Assistant
    • Version history
    • Scheduled runs
    • Hiding and showing cells
    • Long-running cells
    • Report view
    • Environment variables
    • Git and GitHub
  • Connect to Data
    • Connect your data to DataLab
    • Sharing a Data Source
    • Airtable
    • Amazon Athena
    • Amazon S3
    • Databricks
    • Dropbox
    • Files
    • Google Drive
    • Google BigQuery
    • Google Sheets
    • MariaDB
    • Microsoft SQL Server
    • MongoDB
    • MotherDuck
    • MySQL
    • Oracle Database
    • PostgreSQL
    • Redshift
    • Snowflake
    • Supabase
  • Guides
    • Publish a notebook
    • Importing data from flat files
    • Resizing plots
    • Show Bokeh and Pyvis plots
  • Resources
    • Pricing
    • Manage group settings
    • Reporting for Group Admins
    • DataLab for education
    • Technical requirements
    • Addressing slow code
    • Address R vulnerability
    • Get help
Powered by GitBook
On this page
  • Setup
  • Query your Supabase data
  • Further reading

Was this helpful?

  1. Connect to Data

Supabase

PreviousSnowflakeNextPublish a notebook

Last updated 11 months ago

Was this helpful?

This article covers all the required steps to to connect to and query a Postgres database through DataLab. This enables you to:

  • Analyze the data in the Supabase database, like user growth or daily number of sessions. Which data or processes you want to analyze will depend on the application that Supabase is powering.

  • Automate reporting: you can use the "Schedule run" functionality to rerun your analysis on a schedule so that your report always takes in the latest available data as your app is being used.

The steps below and some sample code are also available in (click to create your own copy).

Setup

Create a supabase project

If you don't have a Supabase project yet, go to [supabase.com](https://supabase.com, create a free account, start a new project, and follow all the instructions. When setting a database password, make sure to store it somewhere, as you'll need to use this in the next step.

Locate your database credentials

Every Supabase project is powered by a Postgres database. To find the credentails of this database, from the Supabase dashboard, click the cog icon ("Settings") and select "Database". You'll see all the credentials you need:

Connect to the database

Configure the connection:

  • Database connection name can be anything; give it a meaningful name.

  • Hostname, port, database and username: copy these over from the credentials you found in Supabase in the previous step.

  • Password: Set this to the password that you provided when setting up the Supabase project in the first step.

  • Make sure to check "Encrypt connection".

Click "Connect".

You're all set now!!

Query your Supabase data

  • Create a new workbook.

  • Add a SQL cell, select the Supabase database connection that you created.

  • Write and execute a query, e.g. SELECT * FROM auth.sessions

Further reading

In DataLab, head over to , click "Connect a database" and select "Postgres".

For a deeper dive on Supabase, check out its .

your databases overview
documentation
Supabase
this workbook
this link
Locate your Supabase Postgres database credentails
Set up Supabase postgres database connection credentials in DataLab
Write and execute a query through a SQL cell