Skip to main content

Web2py Dal integration for Bottle.

Project description

Bottle-DAL is a plugin that integrates Web2py DAL Database Abstraction Layer
with your Bottle application. It automatically connects to a database at the
beginning of a request, passes the database handle to the route callback and
closes the connection afterwards.

To automatically detect routes that need a database connection, the plugin
searches for route callbacks that require a `db` keyword argument
(configurable) and skips routes that do not. This removes any overhead for
routes that don't need a database connection.

Usage Example::

from bottle import route, view, run, debug, install
from bottle_dal import DALPlugin, Field

def define_tables(db):
"""My tables definitions here"""

define_tables = lambda db: define_tables(db)))

def index(db):
""" Index Example """

if db(>0).count()==0:

persons = db(>0).select()

return dict(persons=persons.json())

if __name__ == '__main__':
run(host='localhost', port=8080)

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

bottle-web2pydal-0.0.1.tar.gz (124.4 kB view hashes)

Uploaded source

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