Skip to content

Commit

Permalink
Migrate Google analytics example to new design AIP-47 (#25006)
Browse files Browse the repository at this point in the history
related: #22447, #22430
  • Loading branch information
chenglongyan committed Jul 16, 2022
1 parent 84b6799 commit 9b7e4a7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 64 deletions.
Expand Up @@ -35,7 +35,7 @@ List the Accounts
To list accounts from Analytics you can use the
:class:`~airflow.providers.google.marketing_platform.operators.analytics.GoogleAnalyticsListAccountsOperator`.

.. exampleinclude:: /../../airflow/providers/google/marketing_platform/example_dags/example_analytics.py
.. exampleinclude:: /../../tests/system/providers/google/marketing_platform/example_analytics.py
:language: python
:dedent: 4
:start-after: [START howto_marketing_platform_list_accounts_operator]
Expand All @@ -53,7 +53,7 @@ Returns a web property-Google Ads link to which the user has access.
To list web property-Google Ads link you can use the
:class:`~airflow.providers.google.marketing_platform.operators.analytics.GoogleAnalyticsGetAdsLinkOperator`.

.. exampleinclude:: /../../airflow/providers/google/marketing_platform/example_dags/example_analytics.py
.. exampleinclude:: /../../tests/system/providers/google/marketing_platform/example_analytics.py
:language: python
:dedent: 4
:start-after: [START howto_marketing_platform_get_ads_link_operator]
Expand All @@ -71,7 +71,7 @@ Operator returns a list of entity Google Ads links.
To list Google Ads links you can use the
:class:`~airflow.providers.google.marketing_platform.operators.analytics.GoogleAnalyticsRetrieveAdsLinksListOperator`.

.. exampleinclude:: /../../airflow/providers/google/marketing_platform/example_dags/example_analytics.py
.. exampleinclude:: /../../tests/system/providers/google/marketing_platform/example_analytics.py
:language: python
:dedent: 4
:start-after: [START howto_marketing_platform_retrieve_ads_links_list_operator]
Expand Down

This file was deleted.

Expand Up @@ -30,6 +30,9 @@
GoogleAnalyticsRetrieveAdsLinksListOperator,
)

ENV_ID = os.environ.get("SYSTEM_TESTS_ENV_ID")
DAG_ID = "example_google_analytics"

ACCOUNT_ID = os.environ.get("GA_ACCOUNT_ID", "123456789")

BUCKET = os.environ.get("GMP_ANALYTICS_BUCKET", "test-airflow-analytics-bucket")
Expand All @@ -39,10 +42,11 @@
DATA_ID = "kjdDu3_tQa6n8Q1kXFtSmg"

with models.DAG(
"example_google_analytics",
DAG_ID,
schedule_interval='@once', # Override to match your needs,
start_date=datetime(2021, 1, 1),
catchup=False,
tags=["example", "analytics"],
) as dag:
# [START howto_marketing_platform_list_accounts_operator]
list_account = GoogleAnalyticsListAccountsOperator(task_id="list_account")
Expand Down Expand Up @@ -86,3 +90,9 @@
)

upload >> [delete, transform]


from tests.system.utils import get_test_run # noqa: E402

# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest)
test_run = get_test_run(dag)

0 comments on commit 9b7e4a7

Please sign in to comment.