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:
-
Install the Package:
pip install pymongo-connector
-
Import the Class:
from pymongo_connector import mongo_crud
-
Create an Instance of the Class:
mongo = mongo_crud.mongo_operation(client_url='mongodb://localhost:27017/', database_name='mydatabase', collection_name='mycollection')
-
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ca090e8fa2b2fc16661e11da242087f77cb1469637480a9e9354883b91d410a
|
|
| MD5 |
4f01a016e1ebfbeb838d8f38c02bf4f2
|
|
| BLAKE2b-256 |
b906c8fcc9dfc293bc9a32223aaee4cf6cf79640bdffd04516e00ae9eeb73f68
|
File details
Details for the file pymongo_connector-0.0.5-py3-none-any.whl.
File metadata
- Download URL: pymongo_connector-0.0.5-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eea523c810c7d8c7a69a8c9498d482a0e671ba1016610ebe45b4ed9ef7f9c869
|
|
| MD5 |
2ea90fb901138eec5cee19f657daff06
|
|
| BLAKE2b-256 |
28658c9121b160742715f029090be4f1bdad55a6e030d7f509c381ce682cb66e
|