For logging & accessing application data with NoSQL databases (MongoDB & ElasticSearch)
Project description
pynosql-logger
Installation steps if using MongoDB
pip install pymongo #"pymongo[srv]" or "pymongo[aws]"
pip install pynosql-logger
Initialize
from pynosql_logger.loggers import MongoLogger
connection_string = 'your_mongodb_connection_string'
logger = MongoLogger(connection_string)
Installation steps if using ElasticSearch
pip install pynosql-logger
Initialize
from pynosql_logger.loggers import ElasticLogger
elastic_url = 'http://127.0.0.1:9200'
logger = ElasticLogger(elastic_url)
Add Log
req_json = {
'users': {
'first_name': 'Hitesh',
'last_name': 'Mishra',
'email': 'hiteshmishra708@gmail.com'
}
}
resp = logger.add_log(req_json)
Add Bulk Log
req_json = {
'users': [{
'first_name': 'Test',
'last_name': 'User 1',
'email': 'testuser1@mailnesia.com'
}, {
'first_name': 'Test',
'last_name': 'User 2',
'email': 'testuser2@mailnesia.com'
}]
}
resp = logger.add_log(req_json)
Get Log
req_json = {
'users': {
'first_name': 'Hitesh'
}
}
resp = logger.get_log(req_json)
Add All Logs
req_json = {
'collection': 'users'
}
resp = logger.get_all_logs(req_json)
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 python_nosql_logger-1.0.1.tar.gz.
File metadata
- Download URL: python_nosql_logger-1.0.1.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f71552fa57ec7fd20e412e8b95554f3e418976af449562dab0c36a5b70b1cf1
|
|
| MD5 |
39442ff620283ef8eeff899d3b07e404
|
|
| BLAKE2b-256 |
ab716d16cecf3bf1ce0dee3ddc63cbe2666bbbc60a52f8a78e1e2ff37510e73e
|
File details
Details for the file python_nosql_logger-1.0.1-py3-none-any.whl.
File metadata
- Download URL: python_nosql_logger-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
345d099f1896c26f50700fbfa9778b0f4759e51f6376e952b14f8488807694e4
|
|
| MD5 |
eb19b48a84ed885cb19eed24a73b3013
|
|
| BLAKE2b-256 |
423132cc277da49afafa348faa86c56619a60a6d10e3ef8c6d092d30716b12f7
|