A Database Connector interface that follows a factory model pattern.
Project description
Coeus Factory - Database Connector Factory
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 | |
| DynamoDB | boto3 |
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
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file coeusfactory-0.7.0.tar.gz.
File metadata
- Download URL: coeusfactory-0.7.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.2 CPython/3.6.8 Darwin/19.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
173de1bc3ae89818c8bdf4bd153ddab80cebe08126ab40d205429189e1ba353e
|
|
| MD5 |
b53aaaad3f02980439b211e286927fdd
|
|
| BLAKE2b-256 |
047cbd2fef01e55d8595eb16d4719bdd7a2b390ec4ce2e6923f13953f7095b77
|
File details
Details for the file coeusfactory-0.7.0-py3-none-any.whl.
File metadata
- Download URL: coeusfactory-0.7.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.2 CPython/3.6.8 Darwin/19.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e3a9ce7525a6ed8e9d42a735637aebaeb7b4bfc35f0e1fa5f69ccb1ed3de63e
|
|
| MD5 |
d4f534ddeb63e28f4933161c975c473c
|
|
| BLAKE2b-256 |
c9c5cb393f3a8ca3502fc7dde5b661fb97eb071fdf74842113385faf04212b96
|