GithubHelp home page GithubHelp logo

do-etl's Introduction

Diesel oil ETL

This project objective is to extract some caches from pivots tables in a xls file, transform and store this data into a partitioned table.

Dependencies

Build and Usage

This will start an airflow webserver using LocalExecutor with matadata stored in postgres.

docker-compose up --build -d

Access 127.0.0.1:8080 to see the airflow webserver.

print

The do_etl DAG

This Dag uses airflow Python Operator to execute some python scripts.

Basically, this dag receives an xls file as input, then converts the file to xlsx, extracts the caches tables from pivots and store each one as a csv file. Following, the next task creates a dataframe from one of the pivots, does some transformation in the data and stores it in

data/processed/2020_01_22_19_28_53/Vendas_de_Combustiveis_m3_partitioned' 

as a partitioned table by 'ano' and 'mes' columns in parquet format.

Acessing the partitioned data

This structure can be loaded in several databases as a partitioned table for consulting.

Use these statements to create the table in AWS Athena for example:

CREATE EXTERNAL TABLE `vendas_de_combustiveis_m3`(
  `produto` string, 
  `unidade` string, 
  `estado` string, 
  `vol_demanda_m3` double, 
  `timestamp_captura` timestamp)
PARTITIONED BY ( 
  `ano` int,
  `mes` int)
ROW FORMAT SERDE 
  'org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe' 
STORED AS INPUTFORMAT 
  'org.apache.hadoop.mapred.TextInputFormat' 
OUTPUTFORMAT 
  'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION
  's3://'

Then load the partitions with:

MSCK REPAIR TABLE vendas_de_combustiveis_m3;

Then with a

SELECT * FROM vendas_de_combustiveis_m3 limit 10; 

you will have something like this:

print

do-etl's People

Watchers

 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.