Skip to main content

airflow filesystem secret backend using fernet

Project description

airflow-fernet-secrets

License: Apache-2.0 github action PyPI version python version

how to install

pip install airflow-fernet-secrets
# or
# pip install airflow-fernet-secrets[asyncio]

how to use

config

AIRFLOW__SECRETS__BACKEND=airflow.providers.fernet_secrets.secrets.secret_manager.FernetLocalSecretsBackend
# or
# AIRFLOW__SECRETS__BACKEND=airflow_fernet_secrets.secrets.server.ServerFernetLocalSecretsBackend
#
AIRFLOW__PROVIDERS_FERNET_SECRETS__SECRET_KEY=# some fernet key
# ex: 2eu7W6ULuYxnUB4Uz31IYddkdgboa5kLP24bYtegll0=
# or
# AIRFLOW__PROVIDERS_FERNET_SECRETS__SECRET_KEY_CMD=# some fernet key command
# ex: cat /dev/run/secret_key
# or
# AIRFLOW__PROVIDERS_FERNET_SECRETS__SECRET_KEY_SECRET=# some fernet key file
# ex: /dev/run/secret_key
AIRFLOW__PROVIDERS_FERNET_SECRETS__BACKEND_FILE=# some sqlite file path
# ex: /tmp/backend
# or
# AIRFLOW__PROVIDERS_FERNET_SECRETS__BACKEND_FILE_CMD=# some sqlite file path command
# ex: cat /tmp/where_is_backend
# or
# AIRFLOW__PROVIDERS_FERNET_SECRETS__BACKEND_FILE_SECRET=# some sqlite file path file
# ex: /tmp/where_is_backend

example dag

from __future__ import annotations

from typing import TYPE_CHECKING

from pendulum import datetime

from airflow.decorators import dag, task
from airflow.providers.fernet_secrets.operators.sync import DumpSecretsOperator

if TYPE_CHECKING:
    from airflow_fernet_secrets.typings import SecretsParameter


@dag(start_date=datetime(2024, 1, 1), catchup=False, schedule=None)
def dump_connection():
    @task.load_fernet()
    def load_connection() -> SecretsParameter:
        return {"conn_ids": "some_conn_id"}

    dump = DumpSecretsOperator(task_id="dump", fernet_secrets_conn_ids="some_conn_id")
    load = load_connection()
    _ = dump >> load


dump_connection()

TODO

  • exceptions
  • mysql
  • mssql(pymssql)
  • more tests

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_fernet_secrets-0.2.1.tar.gz (31.0 kB view details)

Uploaded Source

Built Distribution

airflow_fernet_secrets-0.2.1-py3-none-any.whl (55.6 kB view details)

Uploaded Python 3

File details

Details for the file airflow_fernet_secrets-0.2.1.tar.gz.

File metadata

File hashes

Hashes for airflow_fernet_secrets-0.2.1.tar.gz
Algorithm Hash digest
SHA256 2c8829d220dffa0dd12661072dff21be97a5ecc3527e0798ab5dadf5b48db521
MD5 09c21caebaddf4605d1c0fbd5b226216
BLAKE2b-256 586a7a2252a6a7612fb9202ce9c2fca7cef848a48db4c3c1f21cdf5479849b5c

See more details on using hashes here.

File details

Details for the file airflow_fernet_secrets-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for airflow_fernet_secrets-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f39e2ddef501397d4f6dfd75e7c0bcd9cb9671ce28cf1aa2cbabac764a5d75cc
MD5 c61fafa708bf456d8badc5f0b4dba5e5
BLAKE2b-256 9bb3ef846d9461ca694bfd48442dd0367505fc6a731cd0b7cff2d8f8845052af

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