Skip to main content

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 of pymongo.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.
  • 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. See help(mongotools.ExpMongoDBConnector) for details.
    • mongotools.ExpMongoDBConnector.db will return the MongoDB collection of the MongoSavingAgent with the lowest activation level (i.e. the primary MongoSavingAgent). It will raise a ValueError, if the lowest activation level is occupied by two or more MongoSavingAgents.
    • mongotools.ExpMongoDBConnector.list_agents will return a list of all MongoSavingAgents added to the experiment.
    • Your experiment needs to have at least one MongoSavingAgent for this class to work.

Refer to the pymongo documentation for further details on how to interact with the clients.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

alfred3_dbtools-0.1.4.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

alfred3_dbtools-0.1.4-py3-none-any.whl (7.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page