Skip to main content
FlareDbIO connects Apache Beam pipelines to FlareDB over Arrow Flight SQL. Use FlareDbIO.read() to run a query and read the result as Beam Rows, and FlareDbIO.write() to stream Rows into a FlareDB table.

Prerequisites

  • A running FlareDB instance. See the Quickstart.
  • The FlareDB I/O artifact in your project:
build.gradle

Read from FlareDB

FlareDbIO.read() executes a SQL query on FlareDB and returns the results as a PCollection<Row>. The output schema is read from the query result.
ReadPipeline.java

Write to FlareDB

FlareDbIO.write() takes a PCollection<Row> and streams it into a FlareDB table. Schema is fixed per table, so every row written to a table must share the same Beam schema. If the destination table does not exist, FlareDbIO.write() creates it automatically using the Beam Row schema.
WritePipeline.java
Rows are buffered within each Beam bundle and sent to FlareDB as Arrow record batches. Use withBatchSize() to control the maximum number of rows in each batch.

Table names

FlareDB addresses tables by fully qualified name: <catalog>.<database>.<table>. The catalog is flare and the database is default, so a scores table is flare.default.scores.

Complete example

WritePipeline.java

Example pipelines

The repo includes runnable examples under flare-db/example:
  • flare-io-write — loads a CSV file into a FlareDB table
  • flare-io-read — reads that table back into a Beam pipeline as Rows
Together they cover the full lifecycle: write data into FlareDB, then query it either with SQL or a Beam pipeline.

Write example

flare-db/example/flare-io-write reads test-data/scores.csv with TextIO, parses each line into a Row using the schema id, name, city, age, score, and writes it to flare.default.scores with FlareDbIO.write().
Run it:
This assumes FlareDB is running locally on 127.0.0.1:8099, and writes into flare.default.scores.

Read example

Once flare.default.scores has data, you can read it two ways. 1. Query it directly with flare-sql
Query
Expected result:
2. Read it into a pipeline with FlareDbIO.read() flare-db/example/flare-io-read runs the same query through FlareDbIO.read(), gets the result back as Beam Rows, and logs each row with a ParDo.
Run it:
Use flare sql for interactive analytics, and FlareDbIO.read() when you need to use the data as input to another Beam pipeline.
Last modified on October 6, 2026