Skip to main content

A Python package to dynamically load CSV files into PostgreSQL tables.

Project description

๐Ÿ“ฆ havinosh_data_loader: CSV to PostgreSQL Ingestion

Seamlessly load CSV files into PostgreSQL dynamically.

Python
PostgreSQL
License
Status


๐Ÿš€ Overview

havinosh_data_loader is a Python package designed to automatically detect CSV structure, create tables, and insert data into PostgreSQL with minimal effort. Just drop your CSV files into a folder, and loader will handle everything dynamically.


๐Ÿ“Œ Features

โœ… Automatic Table Creation โ€“ Reads CSV headers and maps them to PostgreSQL columns
โœ… Dynamic Schema Detection โ€“ Infers data types automatically
โœ… Batch Data Insertion โ€“ Efficiently loads large datasets
โœ… Error Handling โ€“ Logs errors and provides detailed debugging
โœ… Environment Configurations โ€“ Uses .env for secure database credentials
โœ… Modular & Extensible โ€“ Well-structured for easy modifications


๐Ÿ“‚ Project Structure

havinosh_data_loader/
โ”‚โ”€โ”€ havinosh_data_loader/                   # Main package directory
โ”‚   โ”œโ”€โ”€ __init__.py           # Package initialization
โ”‚   โ”œโ”€โ”€ config.py             # Database configuration
โ”‚   โ”œโ”€โ”€ process_csv.py        # CSV processing logic
โ”‚   โ”œโ”€โ”€ db_utils.py           # PostgreSQL connection utilities
โ”‚   โ”œโ”€โ”€ exception.py          # Custom exception handling
โ”‚   โ”œโ”€โ”€ logger.py             # Logging setup
โ”‚โ”€โ”€ scripts/                  # Command-line scripts
โ”‚   โ”œโ”€โ”€ ingest.py             # Main ingestion script
โ”‚โ”€โ”€ tests/                    # Unit tests
โ”‚   โ”œโ”€โ”€ test_process_csv.py
โ”‚โ”€โ”€ csv_files/                # CSV storage (ignored in production)
โ”‚โ”€โ”€ setup.py                  # Package setup script
โ”‚โ”€โ”€ requirements.txt          # Dependencies
โ”‚โ”€โ”€ README.md                 # Documentation
โ”‚โ”€โ”€ .gitignore                # Ignore unnecessary files
โ”‚โ”€โ”€ LICENSE                   # License details

๐Ÿ›  Installation

1๏ธโƒฃ Install via pip

Once published to PyPI, you can install loader using:

pip install havinosh_data_loader

2๏ธโƒฃ Install from Source

Clone the repository and install dependencies:

git clone https://github.com/IAMDSVSSANGRAL/havinosh_data_loader.git  
cd loader  
pip install -r requirements.txt  

โš™ Usage

1๏ธโƒฃ Set Up Your Environment

Create a .env file in the root directory and add:

DB_NAME=your_database
DB_USER=your_username
DB_PASSWORD=your_password
DB_HOST=localhost
DB_PORT=5432

2๏ธโƒฃ Using the CLI

Place your CSV files inside the csv_files/ directory and run the ingestion script:

python scripts/ingest.py

Alternatively, if using the CLI command:

loader --folder csv_files

3๏ธโƒฃ Using the Python Package in Your Script

You can also use havinosh_data_loader programmatically within a Python script:

from havinosh_data_loader.process_csv import CSVProcessor

# Define the folder where CSV files are stored
csv_folder = "csv_files/"

# Initialize the processor
processor = CSVProcessor(csv_folder)

# Start the ingestion process
processor.process_files()

๐Ÿงช Testing

Run unit tests using:

pytest tests/

๐Ÿ“œ License

This project is licensed under the MIT License โ€“ see the LICENSE file for details.


๐Ÿค Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a branch (feature-xyz)
  3. Commit your changes
  4. Push and submit a Pull Request

๐Ÿ“ฌ Contact

๐Ÿ“ง Email: support@havinosh.com
๐ŸŒ GitHub: VISHAL SINGH SANGRAL


๐Ÿš€ Happy Data Ingestion!

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

havinosh_data_loader-0.0.2.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

havinosh_data_loader-0.0.2-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file havinosh_data_loader-0.0.2.tar.gz.

File metadata

  • Download URL: havinosh_data_loader-0.0.2.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for havinosh_data_loader-0.0.2.tar.gz
Algorithm Hash digest
SHA256 128453e5f0c78d4746c434d0ea548478613cbcee63935032188a30f9ef97a48d
MD5 2f2938cf7894ce2717c159b6cfc397ac
BLAKE2b-256 dcfa42b177c0fb4720701e648142dfa3a149f3ad782a8e6e85fdda54f26dcaa2

See more details on using hashes here.

File details

Details for the file havinosh_data_loader-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for havinosh_data_loader-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ae2ef33ebd075ee8eb9d2da3da7b60d155a313d80a841e6e9932dcbdbca212bd
MD5 ad317d40d19c7968f3e2c81f0c13c548
BLAKE2b-256 d4bb97d1c696b6042226f8d6d751f54868f10f43b761f1cd2a1aac7bbe28117b

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