Introdução a pipelines ETL e ELT

ETL e ELT em Python

Jake Roach

Data Engineer

$$

Gráfico de business intelligence, machine learning e IA.

ETL e ELT em Python

Pipelines de dados

... movem dados de uma fonte para um destino e fazem transformações no caminho.

$$

Fontes e destinos de um pipeline de dados.

ETL e ELT em Python

ETL

  • Extrair, transformar, carregar
  • Padrão tradicional de pipeline de dados
  • Fontes podem ser tabulares ou não tabulares
  • Usar Python com pandas

$$

$$

$$

$$

ELT

  • Extrair, carregar, transformar
  • Padrão mais recente
  • Data warehouses
  • Geralmente dados tabulares
ETL e ELT em Python

Extract, transform, load (ETL)

def load(data_frame, target_table):
    # Some custom-built Python logic to load data to SQL
    data_frame.to_sql(name=target_table, con=POSTGRES_CONNECTION)
    print(f"Loading data to the {target_table} table")

# Now, run the data pipeline
extracted_data = extract(file_name="raw_data.csv")
transformed_data = transform(data_frame=extracted_data)
load(data_frame=transformed_data, target_table="cleaned_data")
Extracting data from raw_data.csv
Transforming data to remove 'null' records
Loading data to the cleaned_data table
ETL e ELT em Python

Extract, load, transform (ELT)

...
def transform(source_table, target_table):
    data_warehouse.run_sql("""
        CREATE TABLE {target_table} AS
          SELECT
              <field-name>, <field-name>, ...
          FROM {source_table};
    """)

# Similar to ETL pipelines, call the extract, load, and transform functions
extracted_data = extract(file_name="raw_data.csv")
load(data_frame=extracted_data, table_name="raw_data")
transform(source_table="raw_data", target_table="cleaned_data")
ETL e ELT em Python

Também vamos ver...

$$

Gráfico que mostra tópicos a serem vistos depois no curso.

ETL e ELT em Python

Vamos praticar!

ETL e ELT em Python

Preparing Video For Download...