Reddit + Steampipe
Steampipe is an open-source zero-ETL engine to instantly query cloud APIs using SQL.
Reddit is an American social news aggregation, web content rating, and discussion website.
Example query:
select subreddit_name_prefixed, name, title, score, upvote_ratiofrom reddit_my_postorder by rank;
+-------------------------+-----------+---------------------------------------+-------+--------------------+| subreddit_name_prefixed | name | title | score | upvote_ratio |+-------------------------+-----------+---------------------------------------+-------+--------------------+| r/netsec | t3_q7llj8 | Open source automated NIST SP 800-53… | 146 | 0.949999988079071 || r/aws | t3_q1nwoz | What's your oldest S3 bucket? | 77 | 0.949999988079071 || r/netsec | t3_ot1kwy | Use SQL to query AbuseIPDB deny list… | 55 | 0.8899999856948853 || r/gitlab | t3_ot0tzw | New open source tool to query GitLab… | 31 | 0.9700000286102295 || r/blueteamsec | t3_q7lo6l | Open source automated NIST SP 800-53… | 25 | 0.9200000166893005 |+-------------------------+-----------+---------------------------------------+-------+--------------------+
Documentation
Get started
Install
Download and install the latest Reddit plugin:
steampipe plugin install reddit
Configuration
Installing the latest reddit plugin will create a config file (~/.steampipe/config/reddit.spc
) with a single connection named reddit
:
connection "reddit" { plugin = "reddit"
client_id = "aoxJBaKh9W_wnNLKzJhxSw" client_secret = "P51-fNlprSkGcqdkQzogJ_noqcktis" username = "jane" password = "Pa$$w0rd"}
Create a Reddit app to get your settings:
client_id
- Client ID for your Reddit app.client_secret
- Client secret for your Reddit app.username
- Your username.password
- Your password.
Environment variables are also available as an alternate configuration method:
REDDIT_CLIENT_ID
REDDIT_CLIENT_SECRET
REDDIT_USERNAME
REDDIT_PASSWORD
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)" -- reddit
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_reddit;CREATE SERVER steampipe_reddit FOREIGN DATA WRAPPER steampipe_postgres_reddit OPTIONS (config '<your_config>');CREATE SCHEMA reddit;IMPORT FOREIGN SCHEMA reddit FROM SERVER steampipe_reddit INTO reddit;
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)" -- reddit
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_reddit
function to configure it with plugin-specific options.
$ sqlite3sqlite> .load ./steampipe_sqlite_extension_reddit.sosqlite> select steampipe_configure_reddit('<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)" -- reddit
You can pass the configuration to the command with the --config
argument:
steampipe_export_reddit --config '<your_config>' <table_name>