DataStax-Examples / beam-sdks-java-io-astra

Apache Beam SDK to work with Astra Pipelines

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

beam-sdks-java-io-astra

Apache Beam SDK to work with Astra Pipelines

How To

Installation

To use this SDK, add the following dependency to your project:

GitHub release (with filter)

<dependency>
  <groupId>com.datastax.astra</groupId>
  <artifactId>beam-sdks-java-io-astra</artifactId>
  <version>${latest-version}</version>
</dependency>

Usage

Documentation is avalailable in Awesome Astra with sample codes

  • Read Data From Astra
// LanguageCode is a sample Pojo

// LanguageCodeDaoMapperFactoryFn implements 
// SerializableFunction<CqlSession, AstraDbMapper<LanguageCode>>

// Get binary from File path
byte[] scbZip = AstraSecureConnectBundleUtils
                .loadFromFilePath(options.getAstraSecureConnectBundle());

AstraDbIO.Read<LanguageCode> read = AstraDbIO.<LanguageCode>read()
  .withToken(options.getAstraToken())
  .withKeyspace(options.getAstraKeyspace())
  .withSecureConnectBundle(scbZip)
  .withTable(options.getTable())
  .withCoder(SerializableCoder.of(LanguageCode.class))
  .withMapperFactoryFn(new LanguageCodeDaoMapperFactoryFn())
  .withEntity(LanguageCode.class))

About

Apache Beam SDK to work with Astra Pipelines

License:Apache License 2.0


Languages

Language:Java 100.0%