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.2.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

db_able-1.0.2-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file db-able-1.0.2.tar.gz.

File metadata

  • Download URL: db-able-1.0.2.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12

File hashes

Hashes for db-able-1.0.2.tar.gz
Algorithm Hash digest
SHA256 a35cc7e66c792a90b8ac79f732e9110e899832501ba639cd839a96b7f83864a6
MD5 6c95ffd583fe1724112b842cba46a8a2
BLAKE2b-256 7f937b4c6ebc656c502299a0e9ab62f39e5c7745ba49f9b19c49d004e992fadc

See more details on using hashes here.

File details

Details for the file db_able-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: db_able-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12

File hashes

Hashes for db_able-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 39591382ec5e8dfb2528bfd9ffeb3cf3cc3d308451b651e3178c103845787d3e
MD5 fd192510c7799d44d1b7b0fda407a4b7
BLAKE2b-256 0987473aa617b6472d4190a668102788250251edcc834250d712b4ec17238f96

See more details on using hashes here.

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