Giter Site home page Giter Site logo

airflow-etl-mssql-sample's Introduction

airflow-etl-mssql-sample

Sample Project with Airflow with MS SQL.

Uses this laudio/airflow-mssql docker image for airflow.

Setup and Configuration

Configure

Create a new configuration file airflow.cfg.

 $ cp src/config/airflow.cfg.example src/config/airflow.cfg

Setup First User

Run it first.

$ docker-compose up

Now in a separate terminal run python in the running airflow container.

$ docker-compose exec airflow python

Run the following in the prompt to create a new user for airflow.

Python 3.6.5 (default, Jun  6 2018, 02:51:26)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import airflow
>>> from airflow import models, settings
>>> from airflow.contrib.auth.backends.password_auth import PasswordUser
>>> user = PasswordUser(models.User())
>>> user.username = 'username'
>>> user.email = '[email protected]'
>>> user._set_password = 'password'
>>> session = settings.Session()
>>> session.add(user)
>>> session.commit()
>>> session.close()
>>> exit()

Login to the UI

Now that you've setup a user you can go to the airflow UI http://0.0.0.0:8081 and login.

Usage

Spin up the containers.

$ docker-compose up

Airflow Variables

  • HOST_IP: IP address of the SQL Server host

Airflow Connections

  • MSSQL Datalake connection:

    • conn_id: "mssql_datalake",
    • conn_type: "MS SQL Server",
    • host: HOST_IP,
    • port: 1433,
    • schema: "datalake",
    • login: "sa",
    • password: "Th1sS3cret!"
  • MSSQL App connection:

    • conn_id: "mssql_app",
    • conn_type: "MS SQL Server",
    • host: HOST_IP,
    • port: 1433,
    • schema: "app",
    • login: "sa",
    • password: "Th1sS3cret!"

Environment Variables

  • AIRFLOW_DB_DATA_PATH - Path to store airflow's db (postgres) data.
  • AIRFLOW_DB - Airflow database name.
  • AIRFLOW_DB_USER - Airflow database user.
  • AIRFLOW_DB_PASSWORD - Airflow database Password.
  • AIRFLOW_DB_EXT_PORT - Airflow database exported (external) port.
  • FERNET_KEY / AIRFLOW__CORE__FERNET_KEY - Fernet key used for Airflow cryptography and encryption.
  • AIRFLOW_WEB_EXT_PORT - Airflow web application (UI) exposed external port.

airflow-etl-mssql-sample's People

Contributors

kabirbaidhya avatar safalpandey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.