Skip to content

Commit

Permalink
Use airflow.models.dag.DAG in Google Provider examples (#34614)
Browse files Browse the repository at this point in the history
  • Loading branch information
Taragolis authored Sep 27, 2023
1 parent a5f5e2f commit 2b082f1
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from pathlib import Path
from urllib.parse import quote_plus

from airflow import models
from airflow.models.dag import DAG
from airflow.providers.google.cloud.operators.cloud_sql import CloudSQLExecuteQueryOperator

GCP_PROJECT_ID = os.environ.get("GCP_PROJECT_ID", "example-project")
Expand Down Expand Up @@ -265,7 +265,7 @@ def get_absolute_path(path):
tasks = []


with models.DAG(
with DAG(
dag_id="example_gcp_sql_query",
start_date=datetime(2021, 1, 1),
catchup=False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
import os
from datetime import datetime

from airflow import models
from airflow.models.dag import DAG
from airflow.providers.google.cloud.sensors.tasks import TaskQueueEmptySensor

GCP_PROJECT_ID = os.environ.get("GCP_PROJECT_ID", "example-project")
GCP_ZONE = os.environ.get("GCE_ZONE", "europe-west1-b")
QUEUE_NAME = os.environ.get("GCP_QUEUE_NAME", "testqueue")


with models.DAG(
with DAG(
"example_gcp_cloud_tasks_sensor",
start_date=datetime(2022, 8, 8),
catchup=False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

from facebook_business.adobjects.adsinsights import AdsInsights

from airflow import models
from airflow.models.baseoperator import chain
from airflow.models.dag import DAG
from airflow.providers.google.cloud.operators.bigquery import (
BigQueryCreateEmptyDatasetOperator,
BigQueryCreateEmptyTableOperator,
Expand Down Expand Up @@ -57,7 +57,7 @@
PARAMETERS = {"level": "ad", "date_preset": "yesterday"}
# [END howto_FB_ADS_variables]

with models.DAG(
with DAG(
"example_facebook_ads_to_gcs",
start_date=datetime(2021, 1, 1),
catchup=False,
Expand Down
4 changes: 2 additions & 2 deletions airflow/providers/google/cloud/example_dags/example_looker.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@

from datetime import datetime

from airflow import models
from airflow.models.dag import DAG
from airflow.providers.google.cloud.operators.looker import LookerStartPdtBuildOperator
from airflow.providers.google.cloud.sensors.looker import LookerCheckPdtBuildSensor

with models.DAG(
with DAG(
dag_id="example_gcp_looker",
start_date=datetime(2021, 1, 1),
catchup=False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import re
from datetime import datetime

from airflow import models
from airflow.models.dag import DAG
from airflow.providers.google.cloud.operators.bigquery import (
BigQueryCreateEmptyDatasetOperator,
BigQueryCreateExternalTableOperator,
Expand All @@ -48,7 +48,7 @@ def safe_name(s: str) -> str:
return re.sub("[^0-9a-zA-Z_]+", "_", s)


with models.DAG(
with DAG(
dag_id="example_presto_to_gcs",
start_date=datetime(2021, 1, 1),
catchup=False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import os
from datetime import datetime

from airflow import models
from airflow.models.dag import DAG
from airflow.providers.google.cloud.operators.bigquery import (
BigQueryCreateEmptyDatasetOperator,
BigQueryCreateEmptyTableOperator,
Expand All @@ -43,7 +43,7 @@
SALESFORCE_CONN_ID = os.environ.get("SALESFORCE_CONN_ID", "salesforce_default")


with models.DAG(
with DAG(
"example_salesforce_to_gcs",
start_date=datetime(2021, 1, 1),
catchup=False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from datetime import datetime
from typing import cast

from airflow import models
from airflow.models.dag import DAG
from airflow.models.xcom_arg import XComArg
from airflow.providers.google.cloud.transfers.gcs_to_bigquery import GCSToBigQueryOperator
from airflow.providers.google.marketing_platform.hooks.display_video import GoogleDisplayVideo360Hook
Expand Down Expand Up @@ -87,7 +87,7 @@

START_DATE = datetime(2021, 1, 1)

with models.DAG(
with DAG(
"example_display_video_misc",
start_date=START_DATE,
catchup=False,
Expand Down Expand Up @@ -120,7 +120,7 @@
)
# [END howto_google_display_video_upload_line_items_operator]

with models.DAG(
with DAG(
"example_display_video_sdf",
start_date=START_DATE,
catchup=False,
Expand Down Expand Up @@ -168,7 +168,7 @@
# Task dependency created via `XComArgs`:
# save_sdf_in_gcs >> upload_sdf_to_big_query

with models.DAG(
with DAG(
"example_display_video_v2",
start_date=START_DATE,
catchup=False,
Expand Down

0 comments on commit 2b082f1

Please sign in to comment.