Skip to content

The CDC process that listens to YDB and pushes changes to Postgres in an eventually consistent manner

Notifications You must be signed in to change notification settings

Enigma228322/YdbToPgCdc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YDB Async replication app

Quick start:

docker-compose up -d && go run main.go

Create ydb table and changefeed stream. Not neccessary to do it manualy, cause this implemented in code (ydb_service::SetupYdbTableAndCdc)

CREATE TABLE `/local/my_table` (
    id Uint64,
    data Text,
    PRIMARY KEY (id)
);
ALTER TABLE `/local/my_table`
ADD CHANGEFEED `my_cdc_stream`
WITH (MODE='NEW_AND_OLD_IMAGES', FORMAT='JSON');
go run main.go

Insert record

docker exec -it ydb_server ./ydb -e grpc://ydb:2136 -d /local yql -s "UPSERT INTO my_table (id, data) VALUES (1, 'hello');"

Check result

docker exec -it postgres_server psql -U postgres -d mydb -c "SELECT * FROM my_pg_table ORDER BY id;"

About

The CDC process that listens to YDB and pushes changes to Postgres in an eventually consistent manner

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published