Bottle-sqlite is a plugin that integrates SQLite3 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:
import bottle
from bottle.ext import sqlite
app = bottle.Bottle()
plugin = sqlite.Plugin(dbfile='/tmp/test.db')
app.install(plugin)
@app.route('/show/:item')
def show(item, db):
row = db.execute('SELECT * from items where name=?', item).fetchone()
if row:
return template('showitem', page=row)
return HTTPError(404, "Page not found")
Release files for bottle-sqlite 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bottle-sqlite-0.2.0.tar.gz | 4.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bottle_sqlite-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.5 kB
Release files / bottle-sqlite-0.2.0.tar.gz
| Download URL | bottle-sqlite-0.2.0.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e61b9c4b2240d5abb635ce79fb5d5f4e6e6216f68c0d1670add2df0d5d5db618
|
|
BLAKE2b-256 checksum How to use checksums |
b7b7713b7578f11771ec6fc0ba4f06a5dba120154f66264a954e277c8914187f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.2
|
Release files / bottle_sqlite-0.2.0-py3-none-any.whl
| Download URL | bottle_sqlite-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
33b4b7d003b84207b9d38bc94342ace9d3e83acd392eb882a1d52fc07897619d
|
|
BLAKE2b-256 checksum How to use checksums |
46f51cfbd2643ec28ce262966b13bcaf4887bf1d6f91e30f3d3be61092dcced0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.2
|