Skip to content

Commit

Permalink
Migrate Datastore system tests to new design (AIP-47)
Browse files Browse the repository at this point in the history
Change-Id: Ibc6f0a03a0c6fb374de85d74a7ac62cf6fa55bec
  • Loading branch information
Bartlomiej Hirsz authored and potiuk committed Apr 25, 2022
1 parent 0373fb0 commit 76dc737
Show file tree
Hide file tree
Showing 6 changed files with 377 additions and 198 deletions.
185 changes: 0 additions & 185 deletions airflow/providers/google/cloud/example_dags/example_datastore.py

This file was deleted.

26 changes: 13 additions & 13 deletions docs/apache-airflow-providers-google/operators/cloud/datastore.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Export Entities
To export entities from Google Cloud Datastore to Cloud Storage use
:class:`~airflow.providers.google.cloud.operators.datastore.CloudDatastoreExportEntitiesOperator`

.. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_datastore.py
.. exampleinclude:: /../../tests/system/providers/google/datastore/example_datastore_export_import.py
:language: python
:dedent: 4
:start-after: [START how_to_export_task]
Expand All @@ -52,7 +52,7 @@ Import Entities
To import entities from Cloud Storage to Google Cloud Datastore use
:class:`~airflow.providers.google.cloud.operators.datastore.CloudDatastoreImportEntitiesOperator`

.. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_datastore.py
.. exampleinclude:: /../../tests/system/providers/google/datastore/example_datastore_export_import.py
:language: python
:dedent: 4
:start-after: [START how_to_import_task]
Expand All @@ -66,15 +66,15 @@ Allocate Ids
To allocate IDs for incomplete keys use
:class:`~airflow.providers.google.cloud.operators.datastore.CloudDatastoreAllocateIdsOperator`

.. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_datastore.py
.. exampleinclude:: /../../tests/system/providers/google/datastore/example_datastore_commit.py
:language: python
:dedent: 4
:start-after: [START how_to_allocate_ids]
:end-before: [END how_to_allocate_ids]

An example of a partial keys required by the operator:

.. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_datastore.py
.. exampleinclude:: /../../tests/system/providers/google/datastore/example_datastore_commit.py
:language: python
:dedent: 0
:start-after: [START how_to_keys_def]
Expand All @@ -88,15 +88,15 @@ Begin transaction
To begin a new transaction use
:class:`~airflow.providers.google.cloud.operators.datastore.CloudDatastoreBeginTransactionOperator`

.. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_datastore.py
.. exampleinclude:: /../../tests/system/providers/google/datastore/example_datastore_commit.py
:language: python
:dedent: 4
:start-after: [START how_to_begin_transaction]
:end-before: [END how_to_begin_transaction]

An example of a transaction options required by the operator:

.. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_datastore.py
.. exampleinclude:: /../../tests/system/providers/google/datastore/example_datastore_commit.py
:language: python
:dedent: 0
:start-after: [START how_to_transaction_def]
Expand All @@ -110,15 +110,15 @@ Commit transaction
To commit a transaction, optionally creating, deleting or modifying some entities
use :class:`~airflow.providers.google.cloud.operators.datastore.CloudDatastoreCommitOperator`

.. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_datastore.py
.. exampleinclude:: /../../tests/system/providers/google/datastore/example_datastore_commit.py
:language: python
:dedent: 4
:start-after: [START how_to_commit_task]
:end-before: [END how_to_commit_task]

An example of a commit information required by the operator:

.. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_datastore.py
.. exampleinclude:: /../../tests/system/providers/google/datastore/example_datastore_commit.py
:language: python
:dedent: 0
:start-after: [START how_to_commit_def]
Expand All @@ -132,15 +132,15 @@ Run query
To run a query for entities use
:class:`~airflow.providers.google.cloud.operators.datastore.CloudDatastoreRunQueryOperator`

.. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_datastore.py
.. exampleinclude:: /../../tests/system/providers/google/datastore/example_datastore_query.py
:language: python
:dedent: 4
:start-after: [START how_to_run_query]
:end-before: [END how_to_run_query]

An example of a query required by the operator:

.. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_datastore.py
.. exampleinclude:: /../../tests/system/providers/google/datastore/example_datastore_query.py
:language: python
:dedent: 0
:start-after: [START how_to_query_def]
Expand All @@ -154,7 +154,7 @@ Roll back transaction
To roll back a transaction
use :class:`~airflow.providers.google.cloud.operators.datastore.CloudDatastoreRollbackOperator`

.. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_datastore.py
.. exampleinclude:: /../../tests/system/providers/google/datastore/example_datastore_rollback.py
:language: python
:dedent: 4
:start-after: [START how_to_rollback_transaction]
Expand All @@ -168,7 +168,7 @@ Get operation state
To get the current state of a long-running operation use
:class:`~airflow.providers.google.cloud.operators.datastore.CloudDatastoreGetOperationOperator`

.. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_datastore.py
.. exampleinclude:: /../../tests/system/providers/google/datastore/example_datastore_export_import.py
:language: python
:dedent: 4
:start-after: [START get_operation_state]
Expand All @@ -182,7 +182,7 @@ Delete operation
To delete an operation use
:class:`~airflow.providers.google.cloud.operators.datastore.CloudDatastoreDeleteOperationOperator`

.. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_datastore.py
.. exampleinclude:: /../../tests/system/providers/google/datastore/example_datastore_export_import.py
:language: python
:dedent: 4
:start-after: [START delete_operation]
Expand Down
Loading

0 comments on commit 76dc737

Please sign in to comment.