Skip to main content

An Airflow provider to connect to SAP HANA

Project description

Airflow SAP HANA Provider

This packages enables Airflow to connect to SAP HANA using the official SAP Database cursor hdbcli. This allows you to use the built-in Airflow operators and database hook methods, including methods that interact with SQLAlchemy, via sqlalchemy-hana.

Installing airflow-provider-sap-hana

pip install airflow-provider-sap-hana

Setting Up the Airflow/HANA Express Environment

This repository includes a docker-compose file designed to quickly set up an environment with everything needed to run the example DAG. The docker-compose file is based on the file provided in the Airflow quick-start guide but with several key modifications.

  • An additional service hana-express - This creates a SAP HANA Express instance, a tenant database named HXE, and a schema named 'AIRFLOW'

  • Additional environment variable AIRFLOW_CONN_HANA_DEFAULT which contains the URI needed to connect to the HANA express instance.

  • A custom Dockerfile to extend Airflow to include airflow-provider-sap-hana and Faker, to generate the mock data for the DAG.

The Airflow quick-start guide and the original docker-compose file can be found here Running Airflow in Docker

Initializing Airflow

The following directories and environment files need to be created before you initialize Airflow.

mkdir -p ./dags ./logs ./plugins ./config
echo -e "AIRFLOW_UID=$(id -u)" > .env

To initialize Airflow, run.

docker compose up airflow-init

After initialization is complete, you should see a message like this:

airflow-init_1       | Upgrades done
airflow-init_1       | Admin user airflow created
airflow-init_1       | 2.10.4
start_airflow-init_1 exited with code 0

Starting HANA Express

Before you start HANA Express, you need to create a directory to persist data outside the container and grant it the proper permissions.

mkdir -p ./hana
sudo chown 12000:79 ./hana

To start hana-express, run.

docker compose up hana-express -d

If you want to have visibility to the start-up process, run.

docker compose up hana-express -d && docker logs -f hana-express

This should take several minutes.

Start the Remaining Services

To start the remaining Airflow services, run.

docker compose up -d

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_provider_sap_hana-1.0.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

airflow_provider_sap_hana-1.0.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file airflow_provider_sap_hana-1.0.0.tar.gz.

File metadata

File hashes

Hashes for airflow_provider_sap_hana-1.0.0.tar.gz
Algorithm Hash digest
SHA256 75fb58a47e1951f86ae2e9f5ce8ea7f9aa7ba3715f48d066103150beb63a36fb
MD5 17a3142df9b6873cffeaee694fc9a42e
BLAKE2b-256 646f0895513716084ddeeb1800d7fad774d7b1ada1b8ad67125a4e6a7b7dcb9f

See more details on using hashes here.

File details

Details for the file airflow_provider_sap_hana-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for airflow_provider_sap_hana-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df2959a5468a088c010718d1d381357fc09d5d13374b2b524d28f7a7f4698e7e
MD5 edba0bf8cb7450aa235a80115a67e0cd
BLAKE2b-256 94261e94c0b38e5fe92ec39e5a922c797612d38514fdb21acb7ccc1bacd41440

See more details on using hashes here.

Supported by

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