Google Display & Video 360 Operators¶
Google Display & Video 360 has the end-to-end campaign management features you need.
Prerequisite Tasks¶
To use these operators, you must do a few things:
Select or create a Cloud Platform project using the Cloud Console.
Enable billing for your project, as described in the Google Cloud documentation.
Enable the API, as described in the Cloud Console documentation.
Install API libraries via pip.
pip install 'apache-airflow[google]'Detailed information is available for Installation.
Create SDF download task¶
To create SDF download task use
GoogleDisplayVideo360CreateSDFDownloadTaskOperator
.
create_sdf_download_task = GoogleDisplayVideo360CreateSDFDownloadTaskOperator(
task_id="create_sdf_download_task",
body_request=CREATE_SDF_DOWNLOAD_TASK_BODY_REQUEST,
gcp_conn_id=CONN_ID,
)
operation_name = '{{ task_instance.xcom_pull("create_sdf_download_task")["name"] }}'
Use Jinja templating with
body_request
, impersonation_chain
parameters which allow you to dynamically determine values.
Save SDF files in the Google Cloud Storage¶
To save SDF files and save them in the Google Cloud Storage use
GoogleDisplayVideo360SDFtoGCSOperator
.
save_sdf_in_gcs = GoogleDisplayVideo360SDFtoGCSOperator(
task_id="save_sdf_in_gcs",
operation_name=operation_name,
bucket_name=BUCKET_NAME,
object_name=BUCKET_FILE_LOCATION,
gzip=False,
gcp_conn_id=CONN_ID,
)
Use Jinja templating with
operation_name
, bucket_name
, object_name
, impersonation_chain
parameters which allow you to dynamically determine values.
Waiting for SDF operation¶
Wait for SDF operation is executed by:
GoogleDisplayVideo360GetSDFDownloadOperationSensor
.
wait_for_operation = GoogleDisplayVideo360GetSDFDownloadOperationSensor(
task_id="wait_for_operation", operation_name=operation_name, gcp_conn_id=CONN_ID
)
Use Jinja templating with
operation_name
, impersonation_chain
parameters which allow you to dynamically determine values.