diff --git a/airflow/example_dags/tutorial_objectstorage.py b/airflow/example_dags/tutorial_objectstorage.py index 47db595c24475..11d817400df23 100644 --- a/airflow/example_dags/tutorial_objectstorage.py +++ b/airflow/example_dags/tutorial_objectstorage.py @@ -47,7 +47,6 @@ # [END create_object_storage_path] -# [START instantiate_dag] @dag( schedule=None, start_date=pendulum.datetime(2021, 1, 1, tz="UTC"), @@ -62,9 +61,6 @@ def tutorial_objectstorage(): located [here](https://airflow.apache.org/docs/apache-airflow/stable/tutorial/objectstorage.html) """ - # [END instantiate_dag] - import duckdb - import pandas as pd # [START get_air_quality_data] @task @@ -74,6 +70,8 @@ def get_air_quality_data(**kwargs) -> ObjectStoragePath: This task gets air quality data from the Finnish Meteorological Institute's open data API. The data is saved as parquet. """ + import pandas as pd + execution_date = kwargs["logical_date"] start_time = kwargs["data_interval_start"] @@ -113,6 +111,8 @@ def analyze(path: ObjectStoragePath, **kwargs): #### Analyze This task analyzes the air quality data, prints the results """ + import duckdb + conn = duckdb.connect(database=":memory:") conn.register_filesystem(path.fs) conn.execute(f"CREATE OR REPLACE TABLE airquality_urban AS SELECT * FROM read_parquet('{path}')")