AscSecTeam/knackered — pull request #7 by brettlangdon (2014-04-21 02:04:22+00:00)
Title: add basic sqlite db connection/cursor

here is an example of how we could setup sqlite in this application (or any db solution really).

this pull request should not be considered until ticket #6 is resolved and decided on and/or at the very least this code can be used as an example for implementing a different db solution in the future.

```python
from knackered.db import Database

db = Database("example.db")
with db.cursor() as cursor:
cursor.execute("select * from table")
for row in cursor:
print row
```

or from within flask

```python
from flask import current_app, Blueprint

blueprint = Blueprint("blueprint", __name__)

@blueprint.route("/example")
def example():
with current_app.config["db"].cursor() as cursor:
cursor.execute("sql")
for row in cursor:
print row
```