You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "FloMom (via GitHub)" <gi...@apache.org> on 2023/02/23 14:24:14 UTC

[GitHub] [airflow] FloMom opened a new pull request, #29726: Create CloudSQLCloneInstanceOperator to clone cloudSQL instances.

FloMom opened a new pull request, #29726:
URL: https://github.com/apache/airflow/pull/29726

   Created CloudSQLCloneInstanceOperator to provide a simple way of cloning a cloudSQL instance from a DAG. 
   
   It is making use of google's instance.clone method as described here: https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1/instances/clone 
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] eladkal commented on a diff in pull request #29726: Created CloudSQLCloneInstanceOperator to clone cloudSQL instances.

Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on code in PR #29726:
URL: https://github.com/apache/airflow/pull/29726#discussion_r1119265114


##########
tests/always/test_project_structure.py:
##########
@@ -289,6 +289,7 @@ class TestGoogleProviderProjectStructure(ExampleCoverageTest, AssetsCoverageTest
         "airflow.providers.google.cloud.operators.vertex_ai.endpoint_service.UpdateEndpointOperator",
         "airflow.providers.google.cloud.operators.vertex_ai.batch_prediction_job."
         "GetBatchPredictionJobOperator",
+        "airflow.providers.google.cloud.operators.cloud_sql.CloudSQLCloneInstanceOperator",

Review Comment:
   Great. We are almost there. The example was generated but it is not referenced in the docs.
   See https://airflow.apache.org/docs/apache-airflow-providers-google/stable/operators/cloud/cloud_sql.html
   
   You need to add a short description in the docs and refer to the example you wrote.
   The relevant file to edit is:
   https://github.com/apache/airflow/blob/main/docs/apache-airflow-providers-google/operators/cloud/cloud_sql.rst



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] eladkal commented on a diff in pull request #29726: Created CloudSQLCloneInstanceOperator to clone cloudSQL instances.

Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on code in PR #29726:
URL: https://github.com/apache/airflow/pull/29726#discussion_r1119265114


##########
tests/always/test_project_structure.py:
##########
@@ -289,6 +289,7 @@ class TestGoogleProviderProjectStructure(ExampleCoverageTest, AssetsCoverageTest
         "airflow.providers.google.cloud.operators.vertex_ai.endpoint_service.UpdateEndpointOperator",
         "airflow.providers.google.cloud.operators.vertex_ai.batch_prediction_job."
         "GetBatchPredictionJobOperator",
+        "airflow.providers.google.cloud.operators.cloud_sql.CloudSQLCloneInstanceOperator",

Review Comment:
   Great. We are almost there. The example was created but it is not referenced in the docs so users can't find it.
   See our docs https://airflow.apache.org/docs/apache-airflow-providers-google/stable/operators/cloud/cloud_sql.html
   
   You need to add a short description in the docs and refer to the example you wrote.
   The relevant file to edit is:
   https://github.com/apache/airflow/blob/main/docs/apache-airflow-providers-google/operators/cloud/cloud_sql.rst



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] FloMom commented on a diff in pull request #29726: Add `CloudSQLCloneInstanceOperator`

Posted by "FloMom (via GitHub)" <gi...@apache.org>.
FloMom commented on code in PR #29726:
URL: https://github.com/apache/airflow/pull/29726#discussion_r1119899811


##########
tests/always/test_project_structure.py:
##########
@@ -289,6 +289,7 @@ class TestGoogleProviderProjectStructure(ExampleCoverageTest, AssetsCoverageTest
         "airflow.providers.google.cloud.operators.vertex_ai.endpoint_service.UpdateEndpointOperator",
         "airflow.providers.google.cloud.operators.vertex_ai.batch_prediction_job."
         "GetBatchPredictionJobOperator",
+        "airflow.providers.google.cloud.operators.cloud_sql.CloudSQLCloneInstanceOperator",

Review Comment:
   all right. Thank you for pointing me to the right files. I updated the PR accordingly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] boring-cyborg[bot] commented on pull request #29726: Add `CloudSQLCloneInstanceOperator`

Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #29726:
URL: https://github.com/apache/airflow/pull/29726#issuecomment-1453307116

   Awesome work, congrats on your first merged pull request!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] eladkal merged pull request #29726: Add `CloudSQLCloneInstanceOperator`

Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal merged PR #29726:
URL: https://github.com/apache/airflow/pull/29726


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] eladkal commented on pull request #29726: Add `CloudSQLCloneInstanceOperator`

Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on PR #29726:
URL: https://github.com/apache/airflow/pull/29726#issuecomment-1449577554

   @FloMom static checks are failing :(


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] eladkal commented on a diff in pull request #29726: Created CloudSQLCloneInstanceOperator to clone cloudSQL instances.

Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on code in PR #29726:
URL: https://github.com/apache/airflow/pull/29726#discussion_r1118494690


##########
tests/always/test_project_structure.py:
##########
@@ -289,6 +289,7 @@ class TestGoogleProviderProjectStructure(ExampleCoverageTest, AssetsCoverageTest
         "airflow.providers.google.cloud.operators.vertex_ai.endpoint_service.UpdateEndpointOperator",
         "airflow.providers.google.cloud.operators.vertex_ai.batch_prediction_job."
         "GetBatchPredictionJobOperator",
+        "airflow.providers.google.cloud.operators.cloud_sql.CloudSQLCloneInstanceOperator",

Review Comment:
   What is the motivation to add new operator without example?
   Is there a difficulty in creating the example dag?
   Out goal is to reduce this list not to make it bigger.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] boring-cyborg[bot] commented on pull request #29726: Create CloudSQLCloneInstanceOperator to clone cloudSQL instances.

Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #29726:
URL: https://github.com/apache/airflow/pull/29726#issuecomment-1441885081

   Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
   Here are some useful points:
   - Pay attention to the quality of your code (ruff, mypy and type annotations). Our [pre-commits]( https://github.com/apache/airflow/blob/main/STATIC_CODE_CHECKS.rst#prerequisites-for-pre-commit-hooks) will help you with that.
   - In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/main/docs/apache-airflow/howto/custom-operator.rst) Consider adding an example DAG that shows how users should use it.
   - Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/BREEZE.rst) for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
   - Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
   - Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
   - Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#coding-style-and-best-practices).
   Apache Airflow is a community-driven project and together we are making it better 🚀.
   In case of doubts contact the developers at:
   Mailing List: dev@airflow.apache.org
   Slack: https://s.apache.org/airflow-slack
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] eladkal commented on a diff in pull request #29726: Add `CloudSQLCloneInstanceOperator`

Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on code in PR #29726:
URL: https://github.com/apache/airflow/pull/29726#discussion_r1120777799


##########
docs/apache-airflow-providers-google/operators/cloud/cloud_sql.rst:
##########
@@ -473,6 +473,47 @@ More information
 See Google Cloud SQL API documentation to `patch an instance
 <https://cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/patch>`_.
 
+.. _howto/operator:CloudSQLCloneInstanceOperator:
+
+CloudSQLCloneInstanceOperator
+-----------------------------
+
+Clones an Cloud SQL instance.
+
+For parameter definition, take a look at
+:class:`~airflow.providers.google.cloud.operators.cloud_sql.CloudSQLCloneInstanceOperator`.
+
+Arguments
+"""""""""
+For `clone_context` object attributes please refer to
+`CloneContext <https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/instances/clone#clonecontext>`_
+
+Using the operator
+""""""""""""""""""
+You can create the operator with or without project id. If project id is missing it will be retrieved from the Google
+Cloud connection used. Both variants are shown:
+
+.. exampleinclude:: /../../tests/system/providers/google/cloud/cloud_sql/example_cloud_sql.py
+    :language: python
+    :dedent: 4
+    :start-after: [START howto_operator_cloudsql_clone]
+    :end-before: [END howto_operator_cloudsql_clone]
+
+Templating
+""""""""""
+
+.. literalinclude:: /../../airflow/providers/google/cloud/operators/cloud_sql.py
+    :language: python
+    :dedent: 4
+    :start-after: [START gcp_sql_clone_template_fields]
+    :end-before: [END gcp_sql_clone_template_fields]
+
+More information
+""""""""""""""""
+
+See Google Cloud SQL API documentation to `clone an instance
+<https://cloud.google.com/sql/docs/mysql/admin-api/v1beta4/databases/clone>`_.

Review Comment:
   This link leads to 404
   ![Screenshot 2023-02-28 at 23 16 37](https://user-images.githubusercontent.com/45845474/221982005-87a0fea9-6ec1-414c-8195-0ff636178e86.png)
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on pull request #29726: Created CloudSQLCloneInstanceOperator to clone cloudSQL instances.

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #29726:
URL: https://github.com/apache/airflow/pull/29726#issuecomment-1445159878

   tests/static checks  are failing


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] FloMom commented on a diff in pull request #29726: Created CloudSQLCloneInstanceOperator to clone cloudSQL instances.

Posted by "FloMom (via GitHub)" <gi...@apache.org>.
FloMom commented on code in PR #29726:
URL: https://github.com/apache/airflow/pull/29726#discussion_r1119027730


##########
tests/always/test_project_structure.py:
##########
@@ -289,6 +289,7 @@ class TestGoogleProviderProjectStructure(ExampleCoverageTest, AssetsCoverageTest
         "airflow.providers.google.cloud.operators.vertex_ai.endpoint_service.UpdateEndpointOperator",
         "airflow.providers.google.cloud.operators.vertex_ai.batch_prediction_job."
         "GetBatchPredictionJobOperator",
+        "airflow.providers.google.cloud.operators.cloud_sql.CloudSQLCloneInstanceOperator",

Review Comment:
   Good point. Thank you for the hint. I updated the associated example DAG to demonstrate usage of the CloudSQLCloneInstanceOperator.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org