Skip to content

Enable ClickHouse storage with per-entity @storage directives#11

Merged
moose-code merged 1 commit into
mainfrom
clickhouse-storage
May 19, 2026
Merged

Enable ClickHouse storage with per-entity @storage directives#11
moose-code merged 1 commit into
mainfrom
clickhouse-storage

Conversation

@moose-code

@moose-code moose-code commented May 19, 2026

Copy link
Copy Markdown
Member

Turn on storage.clickhouse: true and annotate each entity:

  • Postgres + ClickHouse (handler reads, derivedFrom targets, GraphQL lookups): Market, OrderFill, OrderMatch, ExchangeStats, PolyUSDStats, PolyUSDAccount, SponsoredMarket
  • ClickHouse only (write-only in handlers, no derivedFrom backrefs): FeeEvent, PolyUSDTransfer, PolyUSDWrap, RewardDistribution, Sponsorship

OrderFill and OrderMatch are write-only in handlers but kept in postgres because Market.fills and Market.matches @derivedFrom would otherwise stop resolving via the GraphQL API.

Summary by CodeRabbit

  • Chores
    • Updated configuration to enable data storage across multiple backend systems, extending data persistence capabilities.

Review Change Stack

Turn on `storage.clickhouse: true` and annotate each entity:

- Postgres + ClickHouse (handler reads, derivedFrom targets, GraphQL lookups):
  Market, OrderFill, OrderMatch, ExchangeStats, PolyUSDStats,
  PolyUSDAccount, SponsoredMarket
- ClickHouse only (write-only in handlers, no derivedFrom backrefs):
  FeeEvent, PolyUSDTransfer, PolyUSDWrap, RewardDistribution, Sponsorship

OrderFill and OrderMatch are write-only in handlers but kept in postgres
because Market.fills and Market.matches @derivedFrom would otherwise stop
resolving via the GraphQL API.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@moose-code moose-code merged commit b8214db into main May 19, 2026
0 of 2 checks passed
@coderabbitai

coderabbitai Bot commented May 19, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8e6a21e0-390d-48dc-92e5-83e8c9a1b517

📥 Commits

Reviewing files that changed from the base of the PR and between 5d03689 and 54c772c.

📒 Files selected for processing (2)
  • config.yaml
  • schema.graphql

📝 Walkthrough

Walkthrough

Configuration and schema changes enable ClickHouse as a storage backend and route indexed data through it. config.yaml enables ClickHouse syncing, and schema.graphql annotates twelve entity types with storage directives specifying which backends persist each type.

Changes

ClickHouse Storage Integration

Layer / File(s) Summary
Enable ClickHouse backend
config.yaml
ClickHouse storage integration is enabled by setting storage.clickhouse: true in the application configuration.
Annotate entities with storage routing
schema.graphql
Twelve GraphQL types receive @storage directives: Market, OrderFill, OrderMatch, PolyUSDAccount, SponsoredMarket, ExchangeStats, and PolyUSDStats are routed to both postgres and clickhouse; FeeEvent, PolyUSDTransfer, PolyUSDWrap, RewardDistribution, and Sponsorship are routed to clickhouse only.

🎯 2 (Simple) | ⏱️ ~10 minutes

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant