public static class DatastoreV1.Write extends PTransform<PCollection<com.google.datastore.v1.Entity>,PDone>
PTransform
that writes Entity
objects to Cloud Datastore.DatastoreIO
,
Serialized Formannotations, displayData, name, resourceHints
Modifier and Type | Method and Description |
---|---|
PDone |
expand(PCollection<com.google.datastore.v1.Entity> input)
Override this method to specify how this
PTransform should be expanded on the given
InputT . |
java.lang.String |
getDatabaseId() |
java.lang.String |
getProjectId() |
void |
populateDisplayData(DisplayData.Builder builder)
Register display data for the given transform or component.
|
java.lang.String |
toString() |
DatastoreV1.Write |
withDatabaseId(java.lang.String databaseId)
Returns a new
DatastoreV1.Write that writes to the Cloud Datastore for the database id. |
DatastoreV1.Write |
withDatabaseId(ValueProvider<java.lang.String> databaseId)
Same as
withDatabaseId(String) but with a ValueProvider . |
DatastoreV1.Write |
withHintNumWorkers(int hintNumWorkers)
Returns a new
DatastoreV1.Write with a different worker count hint for ramp-up throttling. |
DatastoreV1.Write |
withHintNumWorkers(ValueProvider<java.lang.Integer> hintNumWorkers)
Same as
withHintNumWorkers(int) but with a ValueProvider . |
DatastoreV1.Write |
withLocalhost(java.lang.String localhost)
Returns a new
DatastoreV1.Write that writes to the Cloud Datastore Emulator running locally on
the specified host port. |
DatastoreV1.Write |
withProjectId(java.lang.String projectId)
Returns a new
DatastoreV1.Write that writes to the Cloud Datastore for the default database. |
DatastoreV1.Write |
withProjectId(ValueProvider<java.lang.String> projectId)
Same as
withProjectId(String) but with a ValueProvider . |
DatastoreV1.Write |
withRampupThrottlingDisabled()
Returns a new
DatastoreV1.Write that does not throttle during ramp-up. |
DatastoreV1.WriteWithSummary |
withResults()
Returns
DatastoreV1.WriteWithSummary transform which can be used in Wait.on(PCollection[]) to wait until all data is written. |
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, setDisplayData, setResourceHints, validate, validate
public DatastoreV1.Write withProjectId(java.lang.String projectId)
DatastoreV1.Write
that writes to the Cloud Datastore for the default database.public DatastoreV1.Write withDatabaseId(java.lang.String databaseId)
DatastoreV1.Write
that writes to the Cloud Datastore for the database id.public DatastoreV1.Write withProjectId(ValueProvider<java.lang.String> projectId)
withProjectId(String)
but with a ValueProvider
.public DatastoreV1.Write withDatabaseId(ValueProvider<java.lang.String> databaseId)
withDatabaseId(String)
but with a ValueProvider
.public DatastoreV1.Write withLocalhost(java.lang.String localhost)
DatastoreV1.Write
that writes to the Cloud Datastore Emulator running locally on
the specified host port.public DatastoreV1.Write withRampupThrottlingDisabled()
DatastoreV1.Write
that does not throttle during ramp-up.public DatastoreV1.Write withHintNumWorkers(int hintNumWorkers)
DatastoreV1.Write
with a different worker count hint for ramp-up throttling. Value
is ignored if ramp-up throttling is disabled.public DatastoreV1.Write withHintNumWorkers(ValueProvider<java.lang.Integer> hintNumWorkers)
withHintNumWorkers(int)
but with a ValueProvider
.public DatastoreV1.WriteWithSummary withResults()
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());
public java.lang.String toString()
toString
in class PTransform<PCollection<com.google.datastore.v1.Entity>,PDone>
public void populateDisplayData(DisplayData.Builder builder)
PTransform
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.
populateDisplayData
in interface HasDisplayData
populateDisplayData
in class PTransform<PCollection<com.google.datastore.v1.Entity>,PDone>
builder
- The builder to populate with display data.HasDisplayData
public java.lang.String getProjectId()
public java.lang.String getDatabaseId()
public PDone expand(PCollection<com.google.datastore.v1.Entity> input)
PTransform
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).
expand
in class PTransform<PCollection<com.google.datastore.v1.Entity>,PDone>