mirror of
https://github.com/ilri/dspace-statistics-api.git
synced 2024-11-22 14:25:01 +01:00
Alan Orth
9e942736b1
It is much more efficient to cache view and download statistics in a database than to query Solr on demand (not to mention that it is not possible to page easily with facets in Solr). I decided to use SQLite because it is fast, native in Python 3, and doesn't require any extra steps during provisioning (assuming permissions are ok).
12 lines
266 B
Python
12 lines
266 B
Python
from config import SQLITE_DB
|
|
import sqlite3
|
|
|
|
def database_connection():
|
|
connection = sqlite3.connect(SQLITE_DB)
|
|
# allow iterating over row results by column key
|
|
connection.row_factory = sqlite3.Row
|
|
|
|
return connection
|
|
|
|
# vim: set sw=4 ts=4 expandtab:
|