public abstract static class DatastoreV1.Read extends PTransform<PBegin,PCollection<com.google.datastore.v1.Entity>>
PTransform that reads the result rows of a Cloud Datastore query as Entity
objects.DatastoreIO,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static int |
NUM_QUERY_SPLITS_MAX
An upper bound on the number of splits for a query.
|
name| Constructor and Description |
|---|
Read() |
| Modifier and Type | Method and Description |
|---|---|
PCollection<com.google.datastore.v1.Entity> |
expand(PBegin input) |
abstract ValueProvider<String> |
getLiteralGqlQuery() |
abstract String |
getLocalhost() |
abstract ValueProvider<String> |
getNamespace() |
abstract int |
getNumQuerySplits() |
abstract ValueProvider<String> |
getProjectId() |
abstract com.google.datastore.v1.Query |
getQuery() |
void |
populateDisplayData(DisplayData.Builder builder) |
abstract String |
toString() |
DatastoreV1.Read |
withLiteralGqlQuery(String gqlQuery)
Returns a new
DatastoreV1.Read that reads the results of the specified GQL query. |
DatastoreV1.Read |
withLiteralGqlQuery(ValueProvider<String> gqlQuery)
Same as
withLiteralGqlQuery(String) but with a ValueProvider. |
DatastoreV1.Read |
withLocalhost(String localhost)
Returns a new
DatastoreV1.Read that reads from a Datastore Emulator running at the
given localhost address. |
DatastoreV1.Read |
withNamespace(String namespace)
Returns a new
DatastoreV1.Read that reads from the given namespace. |
DatastoreV1.Read |
withNamespace(ValueProvider<String> namespace)
Same as
withNamespace(String) but with a ValueProvider. |
DatastoreV1.Read |
withNumQuerySplits(int numQuerySplits)
|
DatastoreV1.Read |
withProjectId(String projectId)
Returns a new
DatastoreV1.Read that reads from the Cloud Datastore for the specified
project. |
DatastoreV1.Read |
withProjectId(ValueProvider<String> projectId)
Same as
withProjectId(String) but with a ValueProvider. |
DatastoreV1.Read |
withQuery(com.google.datastore.v1.Query query)
Returns a new
DatastoreV1.Read that reads the results of the specified query. |
getAdditionalInputs, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, validatepublic static final int NUM_QUERY_SPLITS_MAX
@Nullable public abstract ValueProvider<String> getProjectId()
@Nullable public abstract com.google.datastore.v1.Query getQuery()
@Nullable public abstract ValueProvider<String> getLiteralGqlQuery()
@Nullable public abstract ValueProvider<String> getNamespace()
public abstract int getNumQuerySplits()
public abstract String toString()
toString in class PTransform<PBegin,PCollection<com.google.datastore.v1.Entity>>public DatastoreV1.Read withProjectId(String projectId)
DatastoreV1.Read that reads from the Cloud Datastore for the specified
project.public DatastoreV1.Read withProjectId(ValueProvider<String> projectId)
withProjectId(String) but with a ValueProvider.public DatastoreV1.Read withQuery(com.google.datastore.v1.Query query)
DatastoreV1.Read that reads the results of the specified query.
Note: Normally, DatastoreIO will read from Cloud Datastore in parallel
across many workers. However, when the Query is configured with a limit using
Query.Builder#setLimit, then all results will be read by a single worker in order
to ensure correct results.
@Experimental(value=SOURCE_SINK) public DatastoreV1.Read withLiteralGqlQuery(String gqlQuery)
DatastoreV1.Read that reads the results of the specified GQL query.
See GQL Reference
to know more about GQL grammar.
Note: This query is executed with literals allowed, so the users should ensure that the query is originated from trusted sources to avoid any security vulnerabilities via SQL Injection.
Experimental: Cloud Datastore does not a provide a clean way to translate
a gql query string to Query, so we end up making a query to the service for
translation but this may read the actual data, although it will be a small amount.
It needs more validation through production use cases before marking it as stable.
@Experimental(value=SOURCE_SINK) public DatastoreV1.Read withLiteralGqlQuery(ValueProvider<String> gqlQuery)
withLiteralGqlQuery(String) but with a ValueProvider.public DatastoreV1.Read withNamespace(String namespace)
DatastoreV1.Read that reads from the given namespace.public DatastoreV1.Read withNamespace(ValueProvider<String> namespace)
withNamespace(String) but with a ValueProvider.public DatastoreV1.Read withNumQuerySplits(int numQuerySplits)
DatastoreV1.Read that reads by splitting the given query into
numQuerySplits.
The semantics for the query splitting is defined below:
NUM_QUERY_SPLITS_MAX will be capped at
NUM_QUERY_SPLITS_MAX.
query has a user limit set, then numQuerySplits will be
ignored and no split will be performed.
public DatastoreV1.Read withLocalhost(String localhost)
DatastoreV1.Read that reads from a Datastore Emulator running at the
given localhost address.public PCollection<com.google.datastore.v1.Entity> expand(PBegin input)
expand in class PTransform<PBegin,PCollection<com.google.datastore.v1.Entity>>public void populateDisplayData(DisplayData.Builder builder)
populateDisplayData in interface HasDisplayDatapopulateDisplayData in class PTransform<PBegin,PCollection<com.google.datastore.v1.Entity>>Copyright © 2016–2017 The Apache Software Foundation. All rights reserved.