Google Cloud Looker Operators¶
Looker is a business intelligence software and big data analytics platform that helps you explore, analyze and share real-time business analytics easily.
Looker has a Public API and associated SDK clients in different languages, which allow programmatic access to the Looker data platform.
For more information visit Looker API documentation.
Prerequisite Tasks¶
To use these operators, you must do a few things:
Install API libraries via pip.
pip install 'apache-airflow[google]'
Detailed information is available for Installation.
Setup a Looker connection in Airflow. You can check Managing Connections and Google Cloud Platform Looker Connection
Start a PDT materialization job¶
To submit a PDT materialization job to Looker you need to provide a model and view name.
The job configuration can be submitted in synchronous (blocking) mode by using:
LookerStartPdtBuildOperator
.
build_pdt_task = LookerStartPdtBuildOperator(
task_id="build_pdt_task",
looker_conn_id="your_airflow_connection_for_looker",
model="your_lookml_model",
view="your_lookml_view",
)
Alternatively, the job configuration can be submitted in asynchronous mode by using:
LookerStartPdtBuildOperator
and
LookerCheckPdtBuildSensor
.
start_pdt_task_async = LookerStartPdtBuildOperator(
task_id="start_pdt_task_async",
looker_conn_id="your_airflow_connection_for_looker",
model="your_lookml_model",
view="your_lookml_view",
asynchronous=True,
)
check_pdt_task_async_sensor = LookerCheckPdtBuildSensor(
task_id="check_pdt_task_async_sensor",
looker_conn_id="your_airflow_connection_for_looker",
materialization_id=start_pdt_task_async.output,
poke_interval=10,
)
There are more arguments to provide in the jobs than the examples show.
For the complete list of arguments take a look at Looker operator arguments at airflow.providers.google.cloud.operators.looker.LookerStartPdtBuildOperator