Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

airflow_providers_wherobots-0.1.9.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file airflow_providers_wherobots-0.1.9.tar.gz.

File metadata

File hashes

Hashes for airflow_providers_wherobots-0.1.9.tar.gz
Algorithm Hash digest
SHA256 b2202f3f9b03ec3a09ea76ad4f3941a87f86a76d62856c43cd3e425a04ed0267
MD5 3b8a7877f793965a3f5cc3482c88786f
BLAKE2b-256 141378fd6bd67d44a35925b6af10198262351e80d0d31be133105a5e94558416

See more details on using hashes here.

File details

Details for the file airflow_providers_wherobots-0.1.9-py3-none-any.whl.

File metadata

File hashes

Hashes for airflow_providers_wherobots-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 38f05319fc726ec668012f716b8cf95a872ff7f11b5bf252d2f53c8d89b7bef3
MD5 ad0771204e06959ebf74db7d7bb14d71
BLAKE2b-256 5ba4d7b0a9ce8d71fc304f8ff1fc63b2c4e8eed96d3fe8c069ee89f8c753c624

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page