substreams-sql

Transform Substreams blockchain data into SQL-ready tables via CDC.

15|1|Updated Jun 9, 2025
One-click install
npx skills add https://github.com/pinax-network/substreams-solana --skill substreams-sql
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: substreams-sql
Source: https://github.com/pinax-network/substreams-solana/tree/main/.github/skills/substreams-sql
Command: npx skills add https://github.com/pinax-network/substreams-solana --skill substreams-sql

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Substreams produce complex data streams that must be stored in SQL databases for operational and analytical use. This Skill provides expert guidance for building SQL sinks with CDC, relational mappings, and materialized views for PostgreSQL, ClickHouse, and similar targets.

Core Features & Use Cases

  • CDC-driven data ingestion: stream row-level changes from blockchain events into SQL tables with transactional semantics.
  • Relational design & analytics: choose normalized or denormalized schemas to support joins, reporting, and dashboards.
  • Real-time analytics & materialized views: define pre-aggregated views to accelerate dashboards and queries.
  • Use Case Example: implement a real-time token transfer ledger in PostgreSQL and a token analytics store in ClickHouse.

Quick Start

Install and configure substreams-sink-sql in a project, define a manifest with a DSN for your database, run the setup to initialize the schema, and execute the sink to start streaming data into your SQL store.

Frequently Asked Questions about substreams-sql

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I stream Substreams blockchain data into PostgreSQL for real-time analytics?

To stream Substreams blockchain data into PostgreSQL, you configure a substreams-sink-sql manifest with a DSN, initialize the schema, and execute the sink to ingest row-level CDC changes into relational tables for real-time analytics.

Can I use materialized views to accelerate dashboards fed by Substreams SQL sinks?

Yes, you can define pre-aggregated materialized views within your SQL sink schema to accelerate dashboard queries and reporting on blockchain data stored in PostgreSQL or ClickHouse.

What is the best way to build a real-time token transfer ledger using Substreams?

The best way to build a real-time token transfer ledger is by using substreams-sink-sql to apply relational mappings and stream CDC changes directly into a SQL database like PostgreSQL with transactional semantics.

Does substreams-sink-sql support ClickHouse for blockchain data ingestion?

Yes, substreams-sink-sql supports ClickHouse, allowing you to configure a DSN to build an operational analytics store and ingest blockchain events using relational schemas and CDC.

How do I configure a manifest to map Substreams data to SQL-ready tables?

You configure the manifest by importing protodefs, defining relational mappings for token transfers or blocks, and specifying your DSN and schema to drive the substreams-sink-sql setup process.

When should I choose normalized versus denormalized schemas for Substreams SQL sinks?

Choose normalized schemas to support relational joins and operational databases, or denormalized schemas to optimize reporting and analytics stores in PostgreSQL or ClickHouse depending on your query needs.