Other Data Destinations
Beyond PostgreSQL, Squid SDK supports saving indexed data to various destinations including Google BigQuery and filesystem-based datasets (CSV, Parquet, JSON).BigQuery
Squids can store their data to BigQuery datasets using the@subsquid/bigquery-store package.
Basic Usage
Define and use theDatabase object as follows:
src/main.ts
Configuration
bqis aBigQueryinstance. When created without arguments it’ll look at theGOOGLE_APPLICATION_CREDENTIALSenvironment variable for a path to a JSON with authentication details.datasetis the path to the target dataset.
tableslists the tables that will be created and populated within the dataset. For every field of thetablesobject an eponymous field of thectx.storeobject will be created; callinginsert()orinsertMany()on such a field will result in data being queued for writing to the corresponding dataset table. The actual writing will be done at the end of the batch in a single transaction, ensuring dataset integrity.
Filesystem Datasets
Overview
Squid SDK provides append-onlyStore interface implementations for saving data to files. The store is designed primarily for offline analytics and supports:
- CSV files - Using
@subsquid/file-store-csv - Parquet files - Using
@subsquid/file-store-parquet - JSON files - Using
@subsquid/file-store-json
Basic Example
Save ERC20Transfer events to transfers.csv files:
Data Partitioning
File-based stores always partition datasets along the “block height” dimension, even when it is not in the schema. A new partition is written when either:- The internal buffer (size governed by
chunkSizeMb) fills up, or - There’s a call to
setForceFlush()during batch processing
Storage Destinations
- Local filesystem - Using
LocalDestclass - S3-compatible storage - Using
S3Destclass for AWS S3, Google Cloud Storage, or other S3-compatible services

