Skip to main content

A python package for connecting with database.

Project description

databseautomationhuz

This is a lightweight Python package that simplifies working with MongoDB. It provides an easy-to-use interface for creating clients, connecting to databases, managing collections, inserting single or multiple records, and performing bulk inserts directly from CSV or Excel files. With built-in type safety checks and automatic handling of database/collection creation, it reduces boilerplate code and prevents common errors when interacting with MongoDB. Ideal for data engineering, ETL pipelines, and machine learning projects that require structured data storage and quick dataset imports into MongoDB.

Example Usage

# Import the class
from databseautomationhuz.mongo_crud import MongoOperation

# Step 1: Initialize MongoDB connection
db = MongoOperation("client_url", "db_name", "collection_name")

# Step 2: Insert a single record
db.insert_record({"name": "Huzaifa", "age": 25}, "Users")

# Step 3: Insert multiple records
db.insert_record(
    [
        {"name": "Sara", "age": 30},
        {"name": "John", "age": 40}
    ],
    "Users"
)

# Step 4: Bulk insert from CSV
db.bulk_insert("employees.csv", "Employees")

# Step 5: Bulk insert from Excel
db.bulk_insert("sales_data.xlsx", "Sales")

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

databaseautomationhuz-0.0.9.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

databaseautomationhuz-0.0.9-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file databaseautomationhuz-0.0.9.tar.gz.

File metadata

  • Download URL: databaseautomationhuz-0.0.9.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for databaseautomationhuz-0.0.9.tar.gz
Algorithm Hash digest
SHA256 88cd15c0275af87ce61d2659d1a1e9519186d9f6ae1b1287e4a7fb91445b939b
MD5 5fabd5aec1bbea655e59097eb19c481d
BLAKE2b-256 6aa828e35c53a0060e382774f3fc315e3222e6459d67e23e9d97f8c4cbe5339a

See more details on using hashes here.

File details

Details for the file databaseautomationhuz-0.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for databaseautomationhuz-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 5d0aafe56fc8d44898abca92ae90c1e11592c96b262751815ae7f0c6a8f7fcd8
MD5 e882f040f3967e06219ea6f0acbbd914
BLAKE2b-256 7e761bf94b9d54ef35aa8c1fc174d5fac8c7f1dae852acd587c07d7637052a95

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