airflow.contrib.hooks.datastore_hook
¶
Module Contents¶
-
class
airflow.contrib.hooks.datastore_hook.
DatastoreHook
(datastore_conn_id='google_cloud_datastore_default', delegate_to=None)[source]¶ Bases:
airflow.contrib.hooks.gcp_api_base_hook.GoogleCloudBaseHook
Interact with Google Cloud Datastore. This hook uses the Google Cloud Platform connection.
This object is not threads safe. If you want to make multiple requests simultaneously, you will need to create a hook per thread.
-
allocate_ids
(self, partialKeys)[source]¶ Allocate IDs for incomplete keys. see https://cloud.google.com/datastore/docs/reference/rest/v1/projects/allocateIds
- Parameters
partialKeys – a list of partial keys
- Returns
a list of full keys.
-
commit
(self, body)[source]¶ Commit a transaction, optionally creating, deleting or modifying some entities.
- Parameters
body – the body of the commit request
- Returns
the response body of the commit request
-
lookup
(self, keys, read_consistency=None, transaction=None)[source]¶ Lookup some entities by key
- Parameters
keys – the keys to lookup
read_consistency – the read consistency to use. default, strong or eventual. Cannot be used with a transaction.
transaction – the transaction to use, if any.
- Returns
the response body of the lookup request.
-
rollback
(self, transaction)[source]¶ Roll back a transaction
- Parameters
transaction – the transaction to roll back
-
run_query
(self, body)[source]¶ Run a query for entities.
- Parameters
body – the body of the query request
- Returns
the batch of query results.
-
get_operation
(self, name)[source]¶ Gets the latest state of a long-running operation
- Parameters
name – the name of the operation resource
-
delete_operation
(self, name)[source]¶ Deletes the long-running operation
- Parameters
name – the name of the operation resource
-
poll_operation_until_done
(self, name, polling_interval_in_seconds)[source]¶ Poll backup operation state until it’s completed
-