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"""
db.define_table('person',Field('name','string'))
install(DALPlugin('sqlite://storage.sqlite',
define_tables = lambda db: define_tables(db)))
@route('/')
def index(db):
""" Index Example """
if db(db.person.id>0).count()==0:
db.person.insert(name='James')
db.person.insert(name='Michael')
db.person.insert(name='Steve')
db.person.insert(name='Robert')
db.commit()
persons = db(db.person.id>0).select()
return dict(persons=persons.json())
if __name__ == '__main__':
debug(True)
run(host='localhost', port=8080)
Metadata
Release files for bottle-web2pydal 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bottle-web2pydal-0.0.1.tar.gz | 124.4 kB | Without provenance | Details for bottle-web2pydal-0.0.1.tar.gz |
Release files / bottle-web2pydal-0.0.1.tar.gz
| Download URL | bottle-web2pydal-0.0.1.tar.gz |
|---|---|
| Size | 124.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd86bf3e805b993c840a5c9e807b993fe7d21af7c56af534574dfbfb1dc31ef2
|
|
BLAKE2b-256 checksum How to use checksums |
1df5112cb583a3d452fabbdb5a13a854143326f1a7d6e01ff9fda6bf6e819d9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for bottle-web2pydal 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.