apache_beam.io.gcp.datastore.v1.fake_datastore module

Fake datastore used for unit testing.

For internal use only; no backwards-compatibility guarantees.

apache_beam.io.gcp.datastore.v1.fake_datastore.create_run_query(entities, batch_size)[source]

A fake datastore run_query method that returns entities in batches.

Note: the outer method is needed to make the entities and batch_size available in the scope of fake_run_query method.

  • entities – list of entities supposed to be contained in the datastore.
  • batch_size – the number of entities that run_query method returns in one request.

A fake Datastore commit method that writes the mutations to a list.

Parameters:mutations – A list to write mutations to.
Returns:A fake Datastore commit method
apache_beam.io.gcp.datastore.v1.fake_datastore.create_response(entities, end_cursor, finish)[source]

Creates a query response for a given batch of scatter entities.

apache_beam.io.gcp.datastore.v1.fake_datastore.create_entities(count, id_or_name=False)[source]

Creates a list of entities with random keys.