You can read data from a relational database into Dataflow using the managed I/O connector to perform scalable data transformations and analytics.
Dependencies
Add the following dependencies to your project:
Java
<dependency>
<groupId>org.apache.beam</groupId>
<artifactId>beam-sdks-java-managed</artifactId>
<version>${beam.version}</version>
</dependency>
<dependency>
<groupId>org.apache.beam</groupId>
<artifactId>beam-sdks-java-io-jdbc</artifactId>
<version>${beam.version}</version>
</dependency>
Example
The following example reads from a PostgreSQL database and writes the data to text files. While this example uses PostgreSQL, configuring other supported databases is similar.
Java
To authenticate to Dataflow, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
What's next
- Write to Databases.
- Learn more about Managed I/O.