feat: add substreams sink postgres and substreams sink clickhouse CLI subcommands#761
Open
maoueh wants to merge 80 commits into
Open
feat: add substreams sink postgres and substreams sink clickhouse CLI subcommands#761maoueh wants to merge 80 commits into
substreams sink postgres and substreams sink clickhouse CLI subcommands#761maoueh wants to merge 80 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fix Quoted() function and push remaining db_changes files. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…hema files Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tration in dialect_clickhouse.go) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add FieldInfo and TableInfo functions to db_proto/proto/utils.go - Create testing.go with TestTx type in db_changes/db/ - Copy database.pb.go locally to avoid external module dependency - Update sinker.go import to use local pbdatabase package Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…-changes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…dialects and sinker) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tgres dialect) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ck_house and postgres db_proto) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…testtx) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ops, user) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tats) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Delete testing.go which redeclares TestTx already defined in testtx.go. This was incorrectly included by a previous agent and is not needed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The sink/sql/services/ package references proto types not in stub. These files were incorrectly added and are not needed by the CLI commands. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…pes) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file was incorrectly placed under sink/sql/db_changes/pb/... The correct location is pb/sf/substreams/sink/database/v1/ which already has a stub. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file is not referenced by any code in the repository. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements two new CLI subcommands:
substreams sink postgres— streams data into a PostgreSQL databasesubstreams sink clickhouse— streams data into a ClickHouse databaseBoth commands support two modes:
substreams-sink-database-changesproto messages to upsert/delete rowsChanges
New files
cmd/substreams/sink_postgres.go— CLI command for Postgres sinkcmd/substreams/sink_clickhouse.go— CLI command for ClickHouse sinksink/sql/— Vendored source packages copied fromstreamingfast/substreams-sink-sqlwith import paths rewritten togithub.com/streamingfast/substreams/sink/sql/...sink/sql/bytes/— bytes encoding helperssink/sql/db_changes/db/— database loader/dialect (Postgres + ClickHouse)sink/sql/db_changes/bundler/— file bundler for batch uploadssink/sql/db_changes/sinker/— sinker implementation using db-changes protosink/sql/db_proto/— sinker implementation using proto messages directlysink/sql/pb/— protobuf generated code for schema/servicessink/sql/shared.go— shared service extraction helperModified files
go.mod/go.sum— added 9 new direct dependencies:github.com/AfterShip/clickhouse-sql-parser v0.4.9github.com/ClickHouse/ch-go v0.68.0github.com/ClickHouse/clickhouse-go/v2 v2.40.3github.com/drone/envsubst v1.0.3github.com/jackc/pgx/v4 v4.18.1github.com/jmoiron/sqlx v1.4.0github.com/lib/pq v1.10.9github.com/streamingfast/substreams-sink-database-changes v1.3.2-0.20260110015235-04b544bbecb9github.com/wk8/go-ordered-map/v2 v2.1.7Notes
substreams-sink-sqlcannot be imported as a direct dependency (circular — it imports substreams), so source packages are vendored undersink/sql/with import paths rewrittenHandleReorgs: false(ClickHouse doesn't support reorgs via history table)HandleReorgs: truegithub.com/mr-tron/base58(already a transitive dep) instead ofbtcutil/base58To sync locally