turbot/supabase
GitHub
steampipe plugin install supabasesteampipe plugin install supabase

Supabase + Steampipe

Supabase is an open-source alternative to Firebase, provides a suite of tools and services that help developers build applications with backend functionalities.

Steampipe is an open-source zero-ETL engine to instantly query cloud APIs using SQL.

List projects in your Supabase organization:

select
name,
region,
created_at,
organization_id
from
supabase_project;
+-----------+------------+---------------------------+----------------------+
| name | region | created_at | organization_id |
+-----------+------------+---------------------------+----------------------+
| Steampunk | us-east-1 | 2023-02-15T20:19:50+05:30 | zuluktedwinzftfztsub |
| Steampipe | ap-south-1 | 2023-02-13T21:29:46+05:30 | zuluktedwinzftfztsub |
+-----------+------------+---------------------------+----------------------+

Documentation

Quick start

Install

Download and install the latest Supabase plugin:

steampipe plugin install supabase

Credentials

ItemDescription
CredentialsAll API requests require a Supabase Access Token to be included in the Authorization header.
PermissionsAPI tokens carry the same privileges as your user account, and if the user permissions change, the API token permissions also change.
RadiusEach connection represents a single Supabase Installation.
Resolution1. Credentials explicitly set in a steampipe config file (~/.steampipe/config/supabase.spc)
2. Credentials specified in environment variables, e.g., SUPABASE_ACCESS_TOKEN.

Configuration

Installing the latest supabase plugin will create a config file (~/.steampipe/config/supabase.spc) with a single connection named supabase:

connection "supabase" {
plugin = "supabase"
# The Supabase personal token.
# All API requests require a Supabase Personal token to be included in the Authorization header.
# To generate or manage your API token, visit your account page: https://app.supabase.com/account/tokens
# This can also be set via the `SUPABASE_ACCESS_TOKEN` environment variable.
# access_token = "sbp_123a45b6c78d901e2345f6steampipe45i432101"
}

Alternatively, you can also use the standard Supabase environment variables to obtain credentials only if other argument (access_token) is not specified in the connection:

export SUPABASE_ACCESS_TOKEN=sbp_123a45b6c78d901e2345f6steampipe45i432101

Postgres FDW

This plugin is available as a native Postgres FDW. Unlike Steampipe CLI, which ships with an embedded Postgres server instance, the Postgres FDW can be installed in any supported Postgres database version.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_postgres_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/postgres.sh)" -- supabase

The installer will prompt you for the plugin name and version, download and install the appropriate files for your OS, system architecture, and Postgres version.

To configure the Postgres FDW, you will create an extension, foreign server, and schema and import the foreign schema.

CREATE EXTENSION IF NOT EXISTS steampipe_postgres_supabase;
CREATE SERVER steampipe_supabase FOREIGN DATA WRAPPER steampipe_postgres_supabase OPTIONS (config '<your_config>');
CREATE SCHEMA supabase;
IMPORT FOREIGN SCHEMA supabase FROM SERVER steampipe_supabase INTO supabase;

SQLite Extension

This plugin is available as a SQLite Extension, making the tables available as SQLite virtual tables.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_sqlite_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/sqlite.sh)" -- supabase

The installer will prompt you for the plugin name, version, and destination directory. It will then determine the OS and system architecture, and it will download and install the appropriate package.

To configure the SQLite extension, load the extension module and then run the steampipe_configure_supabase function to configure it with plugin-specific options.

$ sqlite3
sqlite> .load ./steampipe_sqlite_extension_supabase.so
sqlite> select steampipe_configure_supabase('<your_config>');

Export

This plugin is available as a standalone Export CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- supabase

You can pass the configuration to the command with the --config argument:

steampipe_export_supabase --config '<your_config>' <table_name>