Skip to main content

A Database Connector interface that follows a factory model pattern.

Project description

Coeus Factory - Database Connector Factory

made-with-python PyPI pyversions Maintenance Coverage Awesome Badges

A Database Connector interface that follows a factory model pattern.

Installation

# if using poetry
# highly recommended
poetry add coeusfactory

# also works with standard pip
pip install coeusfactory

Then add necessary database interfaces as necessary. Below are the libraries that works with Coeus Factory.

Database Python Library Status
MongoDB pymongo Passed unit tests
DynamoDB boto3 Needs unit tests

Getting Started

For every first step for any database, initialization and connections will come first. As long as it is supported in the factory, you can pass the parameters you normally handle in supported databse interfaces.

from coeusfactory import ConnectorFactory
cf = ConnectorFactory(
    interface="<database>",
    db="<database-name>"
    # other config or auth params for the db
    username="",
    password=""
)

# db init
cf.handler.initialize()
cf.handler.connect()

Connector Methods

Getting / Creating a model

Users = cf.get_model("Users")
Carts = cf.get_model("Carts")
CustomerReviews = cf.get_model("CustomerReviews")

Retrieval

Users.get_by_id(0)
Users.get({"name": "Test User"})

Insertion

Users.add({"name": "Test User"})

Deletion

Users.delete_by_id(0)
Users.delete({"name": "Test User"})

Modification

Users.update_by_id(0, {"name": "New Name"})
Users.update({"name": "Test User"}, {"name": "New Name"})

Entry Count

Users.count()

Author

Almer Mendoza Ask Me Anything !

ForTheBadge built-with-love forthebadge forthebadge

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

coeusfactory-0.5.0.tar.gz (8.3 kB view hashes)

Uploaded Source

Built Distribution

coeusfactory-0.5.0-py3-none-any.whl (9.7 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