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:
- Gradle
- Maven
build.gradle
Read from FlareDB
FlareDbIO.read() returns a PCollection<Row>. Provide a SQL query with fromQuery; the schema is read from the query result.
ReadPipeline.java
Write to FlareDB
FlareDbIO.write() takes a PCollection<Row> whose rows share a schema and streams them into a FlareDB table. Set the destination with to.
The input
PCollection must have a schema. Set one with setRowSchema or produce it with a schema-aware transform.WritePipeline.java
Rows are buffered per bundle and flushed as Arrow record batches. All rows in a write must use the same schema.
Table names
FlareDB addresses tables with their fully qualified name,<catalog>.<schema>.<table>. The FlareDB catalog is named flare and the default schema is default, so a scores table in the default schema is flare.default.scores.
Complete example
WritePipeline.java