airflow.providers.google.cloud.hooks.datastore
¶
This module contains Google Datastore hook.
Module Contents¶
Classes¶
Interact with Google Cloud Datastore. This hook uses the Google Cloud connection. |
- class airflow.providers.google.cloud.hooks.datastore.DatastoreHook(gcp_conn_id='google_cloud_default', delegate_to=None, api_version='v1', impersonation_chain=None)[source]¶
Bases:
airflow.providers.google.common.hooks.base_google.GoogleBaseHook
Interact with Google Cloud Datastore. This hook uses the Google Cloud connection.
This object is not threads safe. If you want to make multiple requests simultaneously, you will need to create a hook per thread.
- Parameters
api_version (str) – The version of the API it is going to connect to.
- get_conn()[source]¶
Establishes a connection to the Google API.
- Returns
a Google Cloud Datastore service object.
- Return type
Resource
- commit(body, project_id)[source]¶
Commit a transaction, optionally creating, deleting or modifying some entities.
- lookup(keys, project_id, read_consistency=None, transaction=None)[source]¶
Lookup some entities by key.
- Parameters
- Returns
the response body of the lookup request.
- Return type
- poll_operation_until_done(name, polling_interval_in_seconds)[source]¶
Poll backup operation state until it’s completed.
- export_to_storage_bucket(bucket, project_id, namespace=None, entity_filter=None, labels=None)[source]¶
Export entities from Cloud Datastore to Cloud Storage for backup.
Note
Keep in mind that this requests the Admin API not the Data API.
- Parameters
- Returns
a resource operation instance.
- Return type
- import_from_storage_bucket(bucket, file, project_id, namespace=None, entity_filter=None, labels=None)[source]¶
Import a backup from Cloud Storage to Cloud Datastore.
Note
Keep in mind that this requests the Admin API not the Data API.
- Parameters
bucket (str) – The name of the Cloud Storage bucket.
file (str) – the metadata file written by the projects.export operation.
namespace (str | None) – The Cloud Storage namespace path.
entity_filter (dict | None) – specify which kinds/namespaces are to be imported.
project_id (str) – Google Cloud project ID against which to make the request.
- Returns
a resource operation instance.
- Return type