File Store Packages
Squid SDK provides file-based implementations of theStore interface for saving indexed data to various file formats. These stores are designed primarily for offline analytics and support local filesystems and S3-compatible storage.
Supported Formats
- CSV -
@subsquid/file-store-csv - JSON/JSONL -
@subsquid/file-store-json - Parquet -
@subsquid/file-store-parquet
CSV Format Support
Table Implementation
The @subsquid/file-store-csv package provides a Table implementation for writing to CSV files. Constructor accepts:
fileName: string: The name of the output file in every dataset partition folderschema: {[column: string]: ColumnData}: A mapping from CSV column names toColumnDataobjectsoptions?: TableOptions: Optional table configuration
CSV Columns
ColumnData objects determine how data should be serialized. Create them with the Column factory function:
| Column type | Type of the data row field |
|---|---|
Types.String() | string |
Types.Numeric() | number or bigint |
Types.Boolean() | boolean |
Types.DateTime(format?: string) | Date |
Types.JSON<T>() | T |
Types.DateTime accepts an optional strftime-compatible format string.
CSV Example
JSON Format Support
Table Implementation
The @subsquid/file-store-json package provides a Table implementation for writing to JSON and JSONL files.
Constructor signature:
S: TypeScript type describing the table data schemafileName: string: Name of the output file in every dataset partition folderoptions?.lines: Whether to use JSONL instead of plain JSON array (default: false)
JSON Example
Parquet Format Support
Support for the Parquet format is currently experimental. Contact us at the SquidDevs Telegram channel for support.
Table Implementation
Apache Parquet is an advanced format for storing tabular data. It divides table columns into column chunks that are stored contiguously, allowing efficient partial reads. Column chunks can be compressed with row-specific algorithms for enhanced performance.
The @subsquid/file-store-parquet package provides a Table implementation. Constructor accepts:
fileName: string: Name of the output file in every dataset partition folderschema: {[column: string]: ColumnData}: Mapping from Parquet column names toColumnDataobjectsoptions?: TableOptions: Optional table configuration
Parquet Columns
ColumnData objects define storage options for each column. Create them with the Column factory function:
Available column types:
| Column type | Logical type | Primitive type | Valid data contents |
|---|---|---|---|
Types.String() | variable length string | BYTE_ARRAY | string of any length |
Types.Numeric() | - | varies | number or bigint |
Types.Boolean() | - | BOOLEAN | boolean |
Types.DateTime() | timestamp | INT64 | Date |
Types.JSON<T>() | JSON | BYTE_ARRAY | T |
Parquet Example
S3 Support
All file store implementations support S3-compatible storage destinations using theS3Dest class from @subsquid/file-store.
S3 Configuration
Supported S3-Compatible Services
- AWS S3
- Google Cloud Storage
- MinIO
- DigitalOcean Spaces
- Other S3-compatible storage providers
Common Options
Database Options
When creating aDatabase instance, you can configure:
tables: Object mapping table names toTableinstancesdest: Destination for output files (LocalDestorS3Dest)chunkSizeMb: Size threshold for creating new partitions (default: 10 MB)hooks: Optional lifecycle hooks for custom behavior
Data Partitioning
File-based stores partition datasets by block height automatically. A new partition is created when:- The internal buffer reaches
chunkSizeMbsize, or setForceFlush()is called during batch processing

