Skip to main content

Implement basic CRUD operations into DataObject framework with generalized DB access.

Project description

db-able

release build coverage dependencies

Framework to implement basic CRUD operations with DB for DataObject.

Quick start

Set up your connection string to your database.

from db_able import client


client.CONN_STR = '{dialect}+{driver}://{username}:{password}@{host}:{port}/{database}?{query_args}'

Implement the mixins into your DataObject to inject CRUD methods.

from do_py import R
from db_able import Creatable, Deletable, Loadable, Savable


class MyObject(Creatable, Deletable, Loadable, Savable):
    db = '{schema_name}'
    _restrictions = {
        'id': R.INT,
        'key': R.INT
        }
    load_params = ['id']
    create_params = ['key']
    delete_params = ['id']
    save_params = ['id', 'key']


my_obj = MyObject.create(key=555)
my_obj = MyObject.load(id=my_obj.id)
my_obj.key = 777
my_obj.save()
my_obj.delete()

Classmethods create, load, and methods save and delete are made available to your DataObject class.

Use provided SQL Generating utils to expedite implementation.

from db_able.utils.sql_generator import print_all_sps
from examples.a import A

print_all_sps(A)

Testing & Code Quality

Code coverage reports for master, branches, and PRs are posted here in CodeCov.

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

db-able-1.0.1.tar.gz (12.2 kB view hashes)

Uploaded Source

Built Distribution

db_able-1.0.1-py3-none-any.whl (18.6 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