Skip to content

Moving CDC data from PostgreSQL to Apache Kafka with optional mapping using Lua functions

License

Notifications You must be signed in to change notification settings

gustapinto/from-to

Repository files navigation

From To

Installation

The pre-built binaries for FromTo are available in the releases page, they are the recommended installation option, but you can also compile the code yourself

Compiling as binaries

  1. To compile FromTo first clone this repository in your machine
  2. Then open the cloned folder on a shell and run make build to build the binaries for all supported platforms, or run make build/<platform> to build for an specific platform. The currently supported platforms are:
    • linux
    • windows
    • macos

Building Pre Requisites

  1. Go 1.24+
  2. GNU Make (Optional)

Example usage

./from_to_linux_amd64 -config=./postgres_kafka_example_config.yaml

Example config

input:
  connector: "postgres"
  postgresConfig:
    dsn: "postgres://from-to-user:from-to-passw@localhost:5432/from-to-db?sslmode=disable"
    tables:
      - "sales"

outputs:
  salesKafkaOutput:
    connector: "kafka"
    kafkaConfig:
      bootstrapServers:
        - "localhost:9094"
      topics:
        - name: "publicSales"

mappers:
  salesMapper:
    type: "lua"
    luaConfig:
      filePath: "./example/mappers.lua"
      function: "map_sales_event_with_http"

channels:
  salesChannel:
    from: "sales"
    to: "publicSales"
    output: "salesKafkaOutput"
    mapper: "salesMapper"

Additional options and specific documentation on inputs, outputs and mappers can be found at the examples folder

Lua support

FromTo supports Lua scripting to create row mappers, an example mapper can be found at example/mappers.lua. It uses the yuin/gopher-lua VM and preloads some of its libraries for improved DX.

Preloaded libraries

Development

FormTo development follows the Uber Go Style Guide

Development Pre Requisites

  1. Go 1.24+
  2. GNU Make (Optional)
  3. Docker or an compatible alternative
  4. Docker Compose or an compatible alternative

About

Moving CDC data from PostgreSQL to Apache Kafka with optional mapping using Lua functions

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published