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.11.tar.gz (4.4 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.11-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: databaseautomationhuz-0.0.11.tar.gz
  • Upload date:
  • Size: 4.4 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.11.tar.gz
Algorithm Hash digest
SHA256 4d34989a04613033fc7bcf409977a50fd7b6c8ff5253f326ad01c4ac7f6671a1
MD5 58fe8d1d1cef136765a49a4785e668ae
BLAKE2b-256 5b4638b6c7adc1312eb3c878bb00f2f59597bf9c69167b7bfb041d5dff9097c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for databaseautomationhuz-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 13e08d130f5e4d57d19bb5c93bf389594f49305d3e758be23eb7ad9cbf29b4d3
MD5 675459b00dea9fc74c9b0a38f2130678
BLAKE2b-256 7cd4f4ba4f886b670e090089c627f7de70865e5063705a4a6254b64d9409ef76

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