Skip to main content

Centralize database access

Project description

Schemapy allows you to generate objects for centralized database access. You define the schema for your API, the code that needs to be executed, then the validation part is dealt with for you. Everything is then encapsulated in a single object.

Schemapy relies on PyDAL for schema definition but is not tied to it.

See documentation for more informations.

License Development Status Latest release Supported Python versions Supported Python implementations Download format Build status Code test coverage Code Health


pip install schemapy


Using PyDAL:

from schemapy import API, DAL, Field
from datetime import datetime, timedelta

db = DAL('sqlite:memory')
    Field('name', type='string', required=True),
    Field('created_on', type='date')

    Field('subject', type='string', required=True),
    Field('author', type='reference users', required=True),
    Field('created_on', type='date'),
    Field('content', type='text', required=True)

api = API(db)

        Field('begin', type='date', required=True),
        Field('end', type='date', required=True)
def select_posts_by_date(db, req, action):
    query = (db.posts.created_on >= req.begin) | (db.posts.created_on <= req.end)
    return db(query).select()

now =
result = api.select_posts_by_date(
    begin=now - timedelta(days=1),

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for schemapy, version 0.2.4
Filename, size File type Python version Upload date Hashes
Filename, size schemapy-0.2.4-py2.py3-none-any.whl (10.5 kB) File type Wheel Python version 2.7 Upload date Hashes View
Filename, size schemapy-0.2.4.tar.gz (6.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page