Airflow extension for communicating with Wherobots Cloud
Project description
Airflow Providers for Wherobots
Airflow providers to bring Wherobots Cloud's spatial compute to your data workflows and ETLs.
Installation
If you use Poetry in your project, add the
dependency with poetry add
:
$ poetry add airflow-providers-wherobots
Otherwise, just pip install
it:
$ pip install airflow-providers-wherobots
Usage
Create a connection
You first need to create a Connection in Airflow. This can be done from
the UI, or from the command-line. The default Wherobots connection name
is wherobots_default
; if you use another name you must specify that
name with the wherobots_conn_id
parameter when initializing Wherobots
operators.
The only required fields for the connection are:
- the Wherobots API endpoint in the
host
field; - your Wherobots API key in the
password
field.
$ airflow connections add "wherobots_default" \
--conn-type "generic" \
--conn-host "api.cloud.wherobots.com" \
--conn-password "$(< api.key)"
Execute a SQL query
The WherobotsSqlOperator
allows you to run SQL queries on the
Wherobots cloud, from which you can build your ETLs and data
transformation workflows by querying, manipulating, and producing
datasets with WherobotsDB.
Refer to the Wherobots Documentation and this guidance to learn how to read data, transform data, and write results in Spatial SQL with WherobotsDB.
Refer to the Wherobots Apache Airflow Provider Documentation to get more detailed guidance about how to use the Wherobots Apache Airflow Provider.
Example
Below is an example Airflow DAG that executes a SQL query on Wherobots Cloud:
import datetime
from airflow import DAG
from airflow_providers_wherobots.operators.sql import WherobotsSqlOperator
with DAG(
dag_id="example_wherobots_sql_dag",
start_date=datetime.datetime.now(),
schedule="@hourly",
catchup=False
):
# Create a `wherobots.test.airflow_example` table with 100 records
# from the OMF `places_place` dataset.
operator = WherobotsSqlOperator(
task_id="execute_query",
sql=f"""
INSERT INTO wherobots.test.airflow_example
SELECT id, geometry, confidence, geohash
FROM wherobots_open_data.overture.places_place
LIMIT 100
""",
return_last=False,
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file airflow_providers_wherobots-0.1.7.tar.gz
.
File metadata
- Download URL: airflow_providers_wherobots-0.1.7.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a59dbc5bc53833ad26cf5161a564a631ce1a194e31903a8d3d2ab78ba38f5cd |
|
MD5 | 1334a4849dddc7ae0960a59ece251f8c |
|
BLAKE2b-256 | 3bed2c32ce2f028c11be1fff13bec1f4ca7215203da460ea4e564490ef607030 |
File details
Details for the file airflow_providers_wherobots-0.1.7-py3-none-any.whl
.
File metadata
- Download URL: airflow_providers_wherobots-0.1.7-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c1a680d61be19bc04455ff5fe227d45583061f6aea2017ed74c3951f5a848b7 |
|
MD5 | 55d8930531a3cbdf65f89b02bec96db3 |
|
BLAKE2b-256 | 82b0bc6d197c5fe2d7e4232110000666f05b3fc9d6d12b1ff978f1eb4efab7b9 |