Skip to content
Myr

Minor sqlite3 documentation fixes (grammar, etc)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Adam Zapletal · committed by Armin Ronacher · parent 2475411 · Browse files · 1 file+4 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−4 removed

  • other:+4 added−4 removed

1 file+4 added−4 removed

modified:docs/patterns/sqlite3.rst+4 added-4 removed
1 unmodified line
23Using SQLite 3 with Flask4=========================56In Flask you can implement opening of database connections at the beginning7of the request and closing at the end with the6In Flask you can implement the opening of database connections at the7beginning of the request and closing at the end with the8:meth:`~flask.Flask.before_request` and :meth:`~flask.Flask.after_request`9decorators in combination with the special :class:`~flask.g` object.1011So here a simple example of how you can use SQLite 3 with Flask::11So here is a simple example of how you can use SQLite 3 with Flask::1213 import sqlite314 from flask import g15
16 unmodified lines
32Easy Querying33-------------3435Now in each request handling function you can access `g.db` to get the36current open database connection. To simplify working with SQLite a36current open database connection. To simplify working with SQLite, a37helper function can be useful::3839 def query_db(query, args=(), one=False):40 cur = g.db.execute(query, args)
47 unmodified lines