https://github.com/mamerisawesome/coeusfactory
A Database Connector interface for Python 3 that follows a factory model pattern.
https://github.com/mamerisawesome/coeusfactory
List: coeusfactory
database database-factory db-connector python3
Last synced: 2 months ago
JSON representation
A Database Connector interface for Python 3 that follows a factory model pattern.
- Host: GitHub
- URL: https://github.com/mamerisawesome/coeusfactory
- Owner: mamerisawesome
- License: mit
- Created: 2020-02-13T03:53:22.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-28T11:25:16.000Z (about 6 years ago)
- Last Synced: 2026-04-03T10:47:06.556Z (3 months ago)
- Topics: database, database-factory, db-connector, python3
- Language: Python
- Homepage:
- Size: 74.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Coeus Factory - Database Connector Factory
[](https://www.python.org/)
[](https://pypi.python.org/pypi/coeusfactory/)
[](https://GitHub.com/mamerisawesome/coeusfactory/graphs/commit-activity)
[](https://github.com/mamerisawesome/coeusfactory)
[](https://github.com/Naereen/badges)
A Database Connector interface that follows a factory model pattern.
## Installation
```bash
# 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.
```python
from coeusfactory import ConnectorFactory
cf = ConnectorFactory(
interface="",
db=""
# other config or auth params for the db
username="",
password=""
)
# db init
cf.handler.initialize()
cf.handler.connect()
```
## Connector Methods
### Getting / Creating a model
```python
Users = cf.get_model("Users")
Carts = cf.get_model("Carts")
CustomerReviews = cf.get_model("CustomerReviews")
```
### Retrieval
```python
Users.get_by_id(0)
Users.get({"name": "Test User"})
```
### Insertion
```python
Users.add({"name": "Test User"})
```
### Deletion
```python
Users.delete_by_id(0)
Users.delete({"name": "Test User"})
```
### Modification
```python
Users.update_by_id(0, {"name": "New Name"})
Users.update({"name": "Test User"}, {"name": "New Name"})
```
### Entry Count
```python
Users.count()
```
## Author
Almer Mendoza
[](mailto:atmalmer23@gmail.com)
[](https://GitHub.com/Naereen/)
[](https://forthebadge.com)
[](https://forthebadge.com)