Skip to main content

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")

Download files

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

Source Distribution

bottle-sqlite-0.2.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bottle_sqlite-0.2.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file bottle-sqlite-0.2.0.tar.gz.

File metadata

  • Download URL: bottle-sqlite-0.2.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for bottle-sqlite-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e61b9c4b2240d5abb635ce79fb5d5f4e6e6216f68c0d1670add2df0d5d5db618
MD5 420b2aa22ad9528157dd3c0226b7dcc7
BLAKE2b-256 b7b7713b7578f11771ec6fc0ba4f06a5dba120154f66264a954e277c8914187f

See more details on using hashes here.

File details

Details for the file bottle_sqlite-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: bottle_sqlite-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for bottle_sqlite-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33b4b7d003b84207b9d38bc94342ace9d3e83acd392eb882a1d52fc07897619d
MD5 e8f0e8c4a30e6ed876a7460c94b61cfa
BLAKE2b-256 46f51cfbd2643ec28ce262966b13bcaf4887bf1d6f91e30f3d3be61092dcced0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.3

1 file

0.1.2

1 file

0.1

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page