Skip to main content

An ETL package that loads data, cleans and loads it to a postgres database

Project description

etl_package_maiyo008


A simple yet extensible Python ETL (Extract, Transform, Load) pipeline that supports loading data from Parquet files, performing basic transformations, and writing to a PostgreSQL database. Designed to be easily reusable and ideal for automation tasks.

📦 Installation

To install the package from PyPI:

pip install etl-package-maiyo008

🧠 Features

  • Extract data from Parquet files
  • Transform data by:
    • Removing duplicates
    • Dropping rows with blank fields
  • Load data into PostgreSQL with:
    • Chunked inserts for performance
    • Progress feedback via tqdm

📁 Project Structure

etl_package_maiyo008/
├── extract.py
├── transform.py
├── load.py
├── __init__.py

🚀 Quickstart Guide

  1. Import the package
from etl_package_maiyo008.etl import Extract, Transform, Load
  1. Extract data
df = Extract.load_parquet("data/sample_data.parquet")
  1. Transform data
df_clean = Transform.remove_duplicates(df)
df_clean = Transform.remove_blanks(df_clean)
  1. Load Data to PostgreSQL
conn = Load.connect_postgres(
    database="mydb",
    host="localhost",
    user="myuser",
    password="mypassword"
)

Load.write_to_db(df_clean, table_name="cleaned_data", conn=conn)

📚 Method Reference

Extract Extract.load_parquet(path: str)

  • Loads a Parquet file into a pandas DataFrame.

Transform Transform.remove_duplicates(df: pd.DataFrame)

  • Removes duplicate rows from the DataFrame.

Transform.remove_blanks(df: pd.DataFrame)

  • Removes rows with missing/blank values.

Load Load.connect_postgres(database, host, user, password, port=5432)

  • Creates a connection to a PostgreSQL database using SQLAlchemy.

Load.write_to_db(df, table_name, conn, chunk_size=1000)

  • Writes the DataFrame to a PostgreSQL table in chunks, providing progress feedback.

⚠️ Requirements

  • pandas
  • psycopg2-binary
  • SQLAlchemy
  • tqdm
  • pyarrow or fastparquet (for Parquet support)

Install requirements with:

pip install pandas psycopg2-binary SQLAlchemy tqdm pyarrow

✅ License

  • MIT License

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

etl_package_maiyo008-0.0.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

etl_package_maiyo008-0.0.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file etl_package_maiyo008-0.0.1.tar.gz.

File metadata

  • Download URL: etl_package_maiyo008-0.0.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for etl_package_maiyo008-0.0.1.tar.gz
Algorithm Hash digest
SHA256 95ae6fe9617135f6ac8b6010b98227dc4aba648caba5c0e17ae28d583d378283
MD5 4718c36d4cc71fe4a71f853854b1d78f
BLAKE2b-256 3777bb6df98d17ffa26cd13370d748b7278db67f635c5dc0dfe0d086d2ee35c6

See more details on using hashes here.

File details

Details for the file etl_package_maiyo008-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for etl_package_maiyo008-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3b15e0444e0cb2a7a2b834c800270462891ec0cd4f6191bfea85a01e4b22c33b
MD5 62fcd83689e377bdda4a037d54d8fe49
BLAKE2b-256 d28b8d2f665f6a9cd22f00dc4eaf6d5fc9de0973ce306e0544fd9b181aa99020

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page