2018-09-23 15:47:00 +02:00
|
|
|
from config import SQLITE_DB
|
|
|
|
import sqlite3
|
|
|
|
|
2018-09-23 23:00:05 +02:00
|
|
|
def database_connection_rw():
|
2018-09-23 15:47:00 +02:00
|
|
|
connection = sqlite3.connect(SQLITE_DB)
|
|
|
|
# allow iterating over row results by column key
|
|
|
|
connection.row_factory = sqlite3.Row
|
|
|
|
|
|
|
|
return connection
|
|
|
|
|
2018-09-23 23:00:05 +02:00
|
|
|
def database_connection_ro():
|
|
|
|
connection = sqlite3.connect('file:{0}?mode=ro'.format(SQLITE_DB), uri=True)
|
|
|
|
# allow iterating over row results by column key
|
|
|
|
connection.row_factory = sqlite3.Row
|
|
|
|
|
|
|
|
return connection
|
|
|
|
|
2018-09-23 15:47:00 +02:00
|
|
|
# vim: set sw=4 ts=4 expandtab:
|