Code Monkey home page Code Monkey logo

airflow-cloud-etl's Introduction

Airflow Cloud ETL

Airflow Cloud ETL is a simple Data Pipeline repository using Airflow and Google Cloud for Cloud ETL and Batch Processing.

image

Installation

Use git to clone this repository

git clone https://github.com/ghazimuharam/airflow-cloud-etl.git

Prerequisite

Make sure you have python 3.7 installed on your machine

> python --version
Python 3.7.10

To run the script in this repository, you need to install the prerequisite library from requirements.txt

pip install -r requirements.txt

Store all your service account json files to ./conf directory

Usage

Before running Airflow DAGs, you have to configure Airflow Variables and Airflow Connections

Airflow

To run airflow docker container, use Initializing Environment step on this Airflow Official Page, make sure you have docker-compose installed on your machine.

Airflow Variables

image

Change gce_region, gce_zone, project_id, transaction_output_table_id value with your configuration

Airflow Connections

image

Change

  • Keyfile Path to /opt/airflow/conf/key.json
  • Project Id to your-project-name

To run composer_transaction_integrator DAG, you have to configure 2 service account json files.

  • json_input_config_files (Where the big query stored)
  • json_output_config_files (Where to output the processed big query execution)
transaction_integration = IntegrateTransactionOperator(
        task_id='integrate_transaction',
        json_input_config_files="/opt/airflow/conf/bigquery.json",
        json_output_config_files="/opt/airflow/conf/key.json",
        ...

Main

The main application program will create 2 Dataset, 3 Table, and 1 Bucket. The main application program only executed once when initializing the Google Cloud Storage requirements. Before running the main program, run the command below

export GOOGLE_APPLICATION_CREDENTIALS="./path/to/file.json"

Change ./main.py cloud configuration

# Your project name
project_name = 'linen-patrol-285921'

# Your dataset location
location = 'US'

# Your bucket name
bucket_name = 'week2-blank-space'

After setting up the configuration, you can run ./main.py using command below

python main.py

License

MIT

airflow-cloud-etl's People

Contributors

ghazimuharam avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

johanklemantan

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.