PlanetScale + Steampipe
PlanetScale is a MySQL-compatible serverless database platform.
Steampipe is an open-source zero-ETL engine to instantly query cloud APIs using SQL.
List databases in your PlanetScale account:
select name, region_slug, created_atfrom planetscale_database;
+------+-------------+---------------------------+| name | region_slug | created_at |+------+-------------+---------------------------+| test | us-east | 2021-11-16T22:31:03-05:00 || prod | us-west | 2022-02-11T14:03:24-05:00 |+------+-------------+---------------------------+
Documentation
Get started
Install
Download and install the latest PlanetScale plugin:
steampipe plugin install planetscale
Configuration
Installing the latest planetscale plugin will create a config file (~/.steampipe/config/planetscale.spc
) with a single connection named planetscale
:
connection "planetscale" { plugin = "planetscale"
organization = "my_org"
# Required: Set your access token # To get this token: # 1. Install the pscale CLI # 2. Login to the CLI # 3. cat ~/.config/planetscale/access-token token = "pscale_oauth_FWdKCeYK6sYQeJhNPTHRf3Ew_EXAMPLE"}
organization
- Organization to scope all queries to.token
- Access token (note: NOT a service token) from PlanetScale.
Environment variables are also available as an alternate configuration method:
PLANETSCALE_ORGANIZATION
PLANETSCALE_TOKEN
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)" -- planetscale
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_planetscale;CREATE SERVER steampipe_planetscale FOREIGN DATA WRAPPER steampipe_postgres_planetscale OPTIONS (config '<your_config>');CREATE SCHEMA planetscale;IMPORT FOREIGN SCHEMA planetscale FROM SERVER steampipe_planetscale INTO planetscale;
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)" -- planetscale
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_planetscale
function to configure it with plugin-specific options.
$ sqlite3sqlite> .load ./steampipe_sqlite_extension_planetscale.sosqlite> select steampipe_configure_planetscale('<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)" -- planetscale
You can pass the configuration to the command with the --config
argument:
steampipe_export_planetscale --config '<your_config>' <table_name>