/flask-dbkit

dbkit integration for Flask.

Primary LanguagePythonOtherNOASSERTION

Flask-DBKit

Simple dbkit integration for Flask.

Overview

Flask-DBKit aims to provide painless integration of dbkit for the Flask web framework.

Features

  • Wraps each call to the flask wsgi applicaton with a dbkit execution context.
  • Simplify database configuration values for different database engines.

Quickstart

A simple example of how to initialise the extension:

from dbkit import query_value
from flask import Flask
from flask.ext.dbkit import DBKit
import sqlite3

app = Flask(__name__)
app.config['DB_DATABASE'] = ':memory:'

dbkit = DBKit(sqlite3)
dbkit.init_app(app)

@app.route('/')
def index():
    return query_value('SELECT "Hi there from your DB."')

if __name__ == "__main__":
    app.run()

Limitations

  • Currently limits the pool implementation to that as returned by dbkit.create_pool.
  • Causes a pool connection on every application endpoint regardless of whether it actually uses it.