Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import apache_beam as beam
- from apache_beam.io.gcp.datastore.v1.datastoreio import ReadFromDatastore
- from google.cloud.proto.datastore.v1 import query_pb2
- from googledatastore import helper as datastore_helper
- from googledatastore import PropertyFilter
- p = beam.Pipeline(options=pipeline_options)
- # Create a query and filter by kind
- query = query_pb2.Query()
- query.kind.add().name = 'EntityKind'
- # Read just the entry with a specific __key__ property
- datastore_helper.set_property_filter(query.filter, '__key__', PropertyFilter.EQUALS, key)
- result = p | ReadFromDatastore(project=PROJECT_ID, query=query)
Add Comment
Please, Sign In to add comment