Simple MongoDb dependency for nameko (microservices framework). Based on https://github.com/saiqi/nameko-mongodb
Project description
Overview
This is DependencyProvider for Nameko microservices framework which enables users to work with MongoDb.
First of all I should say that this package based on https://github.com/saiqi/nameko-mongodb . Thank you @saiqi :)
What has been changed:
- Automatic uploading to PyPI by Travis-CI (it was a primary purpose for building of my pet projects)
- Disabled by default results logging
- Some fixes to make this stuff work with new Nameko
Requirements
- Python 2.7 / 3.4 / 3.5 / 3.6 / 3.7
- Nameko 3.11+
- MongoDb :)
Installation
The same as you guessing: pip install nameko-mongodb
How to use
There are some configuration options to use this package (required are in bold):
- MONGODB_CONNECTION_URL - connection URL
- MONGODB_DB_NAME - database name. Default is your service name
- MONGODB_USER - if you need to be authenticated, provide username
- MONGODB_PASSWORD
- MONGODB_AUTHENTICATION_BASE - a source to authenticate. See more information in PyMongo documentation
- MONGODB_AUTH_MECHANISM - see more information in PyMongo documentation
You can use the connection following way:
from nameko.rpc import rpc
import MongoDatabase from nameko_mongodb
class YourService(object):
name = 'your_service'
database = MongoDatabase()
@rpc
def find_item(self):
return self.database.your_collection.find_one()
Also this package can log all executions to logging
collection. If you want to use it:
from nameko.rpc import rpc
import MongoDatabase from nameko_mongodb
class YourService(object):
name = 'your_service'
database = MongoDatabase(result_backend=True)
@rpc
def find_item(self):
return self.database.your_collection.find_one()
Contribution
I'd be glad to see your pull requests
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 Distributions
Hashes for nameko-mongodb-0.0.3.dev0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80ab9e4005815c84eccd9c9ec028722b9ae3d4430bb79ae5eed056d97a2a2504 |
|
MD5 | 552b63e3e67292bfc1b8038ca5d7104d |
|
BLAKE2b-256 | dd10fd0179cc91d7189306c1131a6565eb2f9ecea8992a940dc366e45ee96e96 |
Hashes for nameko_mongodb-0.0.3.dev0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa8085425949291740f28b63ba05f984dcd996197aba4e541c0e5f8ae78cf741 |
|
MD5 | a2202193777e873a9bad045f3af1d4b5 |
|
BLAKE2b-256 | a3973ba85904876bb39e01ca024da93db2a4e5c5af6ad99ca404563a1049b0f5 |
Hashes for nameko_mongodb-0.0.3.dev0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbc83b8135c48143bc3a5d3651e47561228f721d617677fab61a0fe8d2fb86a2 |
|
MD5 | 7e38d2c62927d911a0fecff2cdde3eae |
|
BLAKE2b-256 | 942624f29e9f0d228d18c7756a2697b16fba7e3641477bd19c8e8eb1e2fac6cd |