jmcarp commented on a change in pull request #4353: [AIRFLOW-3480] Add Database
Deploy/Update/Delete operators
URL: https://github.com/apache/incubator-airflow/pull/4353#discussion_r244021125
##########
File path: airflow/contrib/hooks/gcp_spanner_hook.py
##########
@@ -168,39 +168,171 @@ def delete_instance(self, project_id, instance_id):
"""
Deletes an existing Cloud Spanner instance.
- :param project_id: The ID of the project which owns the instances,
tables and data.
+ :param project_id: The ID of the GCP project that owns the Cloud
Spanner database.
:type project_id: str
- :param instance_id: The ID of the instance.
+ :param instance_id: The ID of the Cloud Spanner instance.
:type instance_id: str
"""
- client = self.get_client(project_id)
- instance = client.instance(instance_id)
+ instance = self.get_client(project_id).instance(instance_id)
try:
instance.delete()
return True
except GoogleAPICallError as e:
- self.log.error('An error occurred: %s. Aborting.', e.message)
+ self.log.error('An error occurred: %s. Exiting.', e.message)
+ raise e
+
+ def get_database(self, project_id, instance_id, database_id):
+ # type: (str, str, str) -> Optional[Database]
+ """
+ Retrieves a database in Cloud Spanner. If the database does not exist
+ in the specified instance, it returns None.
+
+ :param project_id: The ID of the GCP project that owns the Cloud
Spanner database.
+ :type project_id: str
+ :param instance_id: The ID of the Cloud Spanner instance.
+ :type instance_id: str
+ :param database_id: The ID of the database in Cloud Spanner.
+ :type database_id: str
+ :return:
Review comment:
Can you fill out the empty `:return:` values?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services