Skip to main content

A python package for connecting with database.

Project description

Description

This code defines a class mongo_operation that provides methods for interacting with a MongoDB database. The class allows you to create a MongoDB client, create collections, and insert data in bulk. It supports both single records and lists of records, as well as CSV and Excel file formats.

How to Use

To use this class as a package on PyPI, you can follow these steps:

  1. Install the Package:

    pip install pymongo-connector
    
  2. Import the Class:

    from pymongo_connector import mongo_crud
    
  3. Create an Instance of the Class:

    mongo = mongo_crud.mongo_operation(client_url='mongodb://localhost:27017/', database_name='mydatabase', collection_name='mycollection')
    
  4. Use the Methods:

    # Insert a single record
    mongo.insert_record({'name': 'John', 'age': 30})
    
    # Insert multiple records
    records = [{'name': 'Jane', 'age': 25}, {'name': 'Bob', 'age': 40}]
    mongo.insert_record(records)
    
    # Bulk insert data from a CSV file
    mongo.bulk_insert('data.csv')
    
    # Bulk insert data from an Excel file
    mongo.bulk_insert('data.xlsx')
    

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

pymongo_connector-0.0.5.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

pymongo_connector-0.0.5-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file pymongo_connector-0.0.5.tar.gz.

File metadata

  • Download URL: pymongo_connector-0.0.5.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for pymongo_connector-0.0.5.tar.gz
Algorithm Hash digest
SHA256 5ca090e8fa2b2fc16661e11da242087f77cb1469637480a9e9354883b91d410a
MD5 4f01a016e1ebfbeb838d8f38c02bf4f2
BLAKE2b-256 b906c8fcc9dfc293bc9a32223aaee4cf6cf79640bdffd04516e00ae9eeb73f68

See more details on using hashes here.

File details

Details for the file pymongo_connector-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for pymongo_connector-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 eea523c810c7d8c7a69a8c9498d482a0e671ba1016610ebe45b4ed9ef7f9c869
MD5 2ea90fb901138eec5cee19f657daff06
BLAKE2b-256 28658c9121b160742715f029090be4f1bdad55a6e030d7f509c381ce682cb66e

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