Bottle-MySQL is a plugin that integrates MySQL 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.
Results are returned as dictionaries.
Usage Example:
import bottle
import bottle_mysql
app = bottle.Bottle()
# dbhost is optional, default is localhost
plugin = bottle_mysql.Plugin(dbuser='user', dbpass='pass', dbname='db')
app.install(plugin)
@app.route('/show/:<tem>')
def show(item, db):
db.execute('SELECT * from items where name="%s"', (item,))
row = db.fetchone()
if row:
return template('showitem', page=row)
return HTTPError(404, "Page not found")
Metadata
Release files for bottle-mysql 0.1.4
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 | |
|---|---|---|---|---|
| bottle-mysql-0.1.4.tar.gz | 2.9 kB | Without provenance | Details |
Release files / bottle-mysql-0.1.4.tar.gz
| Download URL | bottle-mysql-0.1.4.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
966041f4330a0f2aa377a688dffe558aa456ceb34b63d722dcbda91408f493b9
|
|
BLAKE2b-256 checksum How to use checksums |
c16b2354468d5be26df1a0ba0815afe2a7024315e735eb88d961aaad830c0697
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for bottle-mysql 0.1.4
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.