Skip to content

Instantly share code, notes, and snippets.

View matthieucham's full-sized avatar

matthieucham

  • Stack-Labs
  • France
View GitHub Profile
@matthieucham
matthieucham / BigQueryAutoCreateTable.java
Created January 15, 2021 20:55
Beam transform to work around BEAM-3772 issue : create empty table in before batch loading the PCollection in it.
import com.google.cloud.bigquery.*;
import org.apache.beam.sdk.transforms.*;
import org.apache.beam.sdk.transforms.windowing.FixedWindows;
import org.apache.beam.sdk.transforms.windowing.Window;
import org.apache.beam.sdk.values.KV;
import org.apache.beam.sdk.values.PCollection;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.cache.Cache;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.cache.CacheBuilder;
import org.joda.time.Duration;