A package that provides tools for interacting with databases when working with alfred3 experiments.
Project description
alfred3_dbtools
This module provides additional tools for working with databases in the context of alfred3 experiments (see alfred3 on GitHub).
Installation
pip install alfred3_dbtools
Usage
To import the tools for working with mongodb, include this statement at the beginning of your script:
from alfred3_dbtools import mongotools
You can then access the classes provided in the module:
-
mongotools.MongoDBConnector
can be used to establish an independent connection to an instance ofpymongo.MongoClient
.- Access to the client is provided via
mongotools.MongoDBConnector.db
. This will return either a database instance or, if a specific collection was given during initialisation, that collection instance. - See
help(mongotools.MongoDBConnector)
for details.
- Access to the client is provided via
-
mongotools.ExpMongoDBConnector
can be used to establish a connection to an experiments' MongoDBs.- The constructor takes one parameter:
experiment
, which needs to be an alfred experiment. Seehelp(mongotools.ExpMongoDBConnector)
for details. mongotools.ExpMongoDBConnector.db
will return the MongoDB collection of theMongoSavingAgent
with the lowest activation level (i.e. the primaryMongoSavingAgent
). It will raise aValueError
, if the lowest activation level is occupied by two or moreMongoSavingAgent
s.mongotools.ExpMongoDBConnector.list_agents
will return a list of allMongoSavingAgent
s added to the experiment.- Your experiment needs to have at least one MongoSavingAgent for this class to work.
- The constructor takes one parameter:
Refer to the pymongo documentation for further details on how to interact with the clients.
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
File details
Details for the file alfred3_dbtools-0.1.4.tar.gz
.
File metadata
- Download URL: alfred3_dbtools-0.1.4.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 862494f03cb27adbd6aed51601d408400f06e3de461b3c0c1bb316cdcc753f04 |
|
MD5 | c7c591af1685c0d62f6a7723f6b1c752 |
|
BLAKE2b-256 | a8ea5081f5f0f35cdcfc6d2c00bb091c100e76b8591947259c140465fc31b3b1 |
File details
Details for the file alfred3_dbtools-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: alfred3_dbtools-0.1.4-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63d661fa4bbb09f6564bd1ee7b10de923f8d5ee450ad81210443bef39473eee8 |
|
MD5 | d6a72c579790b719ebfca0fb0f185fc5 |
|
BLAKE2b-256 | 43371310c9aa2b753045cb545733c840544744def7f20e7d55309f90d31c2e19 |