bottle-pgsql-0.2
توضیحات
PgSQL integration for Bottle
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | bottle-pgsql-0.2 |
| نام | bottle-pgsql |
| نسخه کتابخانه | 0.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Arif Kurniawan |
| ایمیل نویسنده | arifk97@gmail.com |
| آدرس صفحه اصلی | https://github.com/raisoblast/bottle-pgsql |
| آدرس اینترنتی | https://pypi.org/project/bottle-pgsql/ |
| مجوز | MIT |
Bottle-PgSQL is based on Bottle-MySQL and Bottle-sqlite.
Bottle-PgSQL is a plugin that integrates PostgreSQL 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_pgsql
app = bottle.Bottle()
plugin = bottle_pgsql.Plugin('dbname=db user=user password=pass')
app.install(plugin)
@app.route('/show/:<item>')
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")
نحوه نصب
نصب پکیج whl bottle-pgsql-0.2:
pip install bottle-pgsql-0.2.whl
نصب پکیج tar.gz bottle-pgsql-0.2:
pip install bottle-pgsql-0.2.tar.gz