a3mongo
English | 简体中文
a3mongo is a simple wrapper around pymongo to make it easier to use.
1. Introduction
- Multiple MongoDB services can be configured at the same time.
- Some commonly used methods have been encapsulated.
2. Usage
Install
pip install a3mongo
Examples
CONF = {
'site_a': {
"host": "127.0.0.1",
"port": 27017,
"username": "username",
"password": "password",
"authSource": "site_a",
"authMechanism": "SCRAM-SHA-256"
},
'site_b': {
"host": "127.0.0.1",
"port": 27018,
"username": "username",
"password": "password",
"authSource": "site_b",
"authMechanism": "SCRAM-SHA-256"
}
}
from a3mongo import MongoClientFactory, MongoTable
class SiteUser(MongoTable):
table_name = 'site_user'
db_conf_name = 'site_a'
if __name__ == '__main__':
MongoClientFactory.init_mongo_clients(conf=CONF)
site_user = SiteUser()
site_user.create_table()
site_user.create_index_list(['name', 'gender', 'email'])
site_user.upsert_many([
{'name': 'Alice', 'gender': 'female', 'email': 'alice@example.com'},
{'name': 'Bob', 'gender':'male', 'email': 'bob@example.com'},
{'name': 'Charlie', 'gender': 'male', 'email': 'charlie@example.com'},
])
male_users = site_user.find({'gender':'male'})
Metadata
Release files for a3mongo 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| a3mongo-0.3.0.tar.gz | 5.2 kB | Without provenance | Details for a3mongo-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| a3mongo-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for a3mongo-0.3.0-py3-none-any.whl |
Total release size: 10.6 kB
Release files / a3mongo-0.3.0.tar.gz
| Download URL | a3mongo-0.3.0.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a79ff5c9606b25a2077438749a21f2ff54a701401b2867c4aafca71a6a73bc59
|
|
BLAKE2b-256 checksum How to use checksums |
a11e355b1e43d4f693fe673ba10781c7b6701ccf2f3cc0178c1e704e1cb343d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.2
|
Release files / a3mongo-0.3.0-py3-none-any.whl
| Download URL | a3mongo-0.3.0-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
90a9b13fbfba971606117bba90a4fd93f174b1ec7c5355f5d10b11e73b63e531
|
|
BLAKE2b-256 checksum How to use checksums |
2aa936ffa0111ff3edf627d5073a00fcc37c265e20539e0c27455fae60c442fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.2
|
Security for a3mongo 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.