Class DatastoreV1.Write

java.lang.Object
org.apache.beam.sdk.transforms.PTransform<PCollection<com.google.datastore.v1.Entity>,PDone>
org.apache.beam.sdk.io.gcp.datastore.DatastoreV1.Write
All Implemented Interfaces:
Serializable, HasDisplayData
Enclosing class:
DatastoreV1

public static class DatastoreV1.Write extends PTransform<PCollection<com.google.datastore.v1.Entity>,PDone>
A PTransform that writes Entity objects to Cloud Datastore.
See Also:
  • Method Details

    • withProjectId

      public DatastoreV1.Write withProjectId(String projectId)
      Returns a new DatastoreV1.Write that writes to the Cloud Datastore for the default database.
    • withDatabaseId

      public DatastoreV1.Write withDatabaseId(String databaseId)
      Returns a new DatastoreV1.Write that writes to the Cloud Datastore for the database id.
    • withProjectId

      public DatastoreV1.Write withProjectId(ValueProvider<String> projectId)
    • withDatabaseId

      public DatastoreV1.Write withDatabaseId(ValueProvider<String> databaseId)
    • withLocalhost

      public DatastoreV1.Write withLocalhost(String localhost)
      Returns a new DatastoreV1.Write that writes to the Cloud Datastore Emulator running locally on the specified host port.
    • withRampupThrottlingDisabled

      public DatastoreV1.Write withRampupThrottlingDisabled()
      Returns a new DatastoreV1.Write that does not throttle during ramp-up.
    • withHintNumWorkers

      public DatastoreV1.Write withHintNumWorkers(int hintNumWorkers)
      Returns a new DatastoreV1.Write with a different worker count hint for ramp-up throttling. Value is ignored if ramp-up throttling is disabled.
    • withHintNumWorkers

      public DatastoreV1.Write withHintNumWorkers(ValueProvider<Integer> hintNumWorkers)
    • withResults

      public DatastoreV1.WriteWithSummary withResults()
      Returns DatastoreV1.WriteWithSummary transform which can be used in Wait.on(PCollection[]) to wait until all data is written.

      Example: write a PCollection to one database and then to another database, making sure that writing a window of data to the second database starts only after the respective window has been fully written to the first database.

      
       PCollection<Entity> entities = ... ;
       PCollection<DatastoreV1.WriteSuccessSummary> writeSummary =
               entities.apply(DatastoreIO.v1().write().withProjectId(project).withResults());
       
    • toString

      public String toString()
      Overrides:
      toString in class PTransform<PCollection<com.google.datastore.v1.Entity>,PDone>
    • populateDisplayData

      public void populateDisplayData(DisplayData.Builder builder)
      Description copied from class: PTransform
      Register display data for the given transform or component.

      populateDisplayData(DisplayData.Builder) is invoked by Pipeline runners to collect display data via DisplayData.from(HasDisplayData). Implementations may call super.populateDisplayData(builder) in order to register display data in the current namespace, but should otherwise use subcomponent.populateDisplayData(builder) to use the namespace of the subcomponent.

      By default, does not register any display data. Implementors may override this method to provide their own display data.

      Specified by:
      populateDisplayData in interface HasDisplayData
      Overrides:
      populateDisplayData in class PTransform<PCollection<com.google.datastore.v1.Entity>,PDone>
      Parameters:
      builder - The builder to populate with display data.
      See Also:
    • getProjectId

      public String getProjectId()
    • getDatabaseId

      public String getDatabaseId()
    • expand

      public PDone expand(PCollection<com.google.datastore.v1.Entity> input)
      Description copied from class: PTransform
      Override this method to specify how this PTransform should be expanded on the given InputT.

      NOTE: This method should not be called directly. Instead apply the PTransform should be applied to the InputT using the apply method.

      Composite transforms, which are defined in terms of other transforms, should return the output of one of the composed transforms. Non-composite transforms, which do not apply any transforms internally, should return a new unbound output and register evaluators (via backend-specific registration methods).

      Specified by:
      expand in class PTransform<PCollection<com.google.datastore.v1.Entity>,PDone>