mirror of
https://github.com/ilri/dspace-statistics-api.git
synced 2024-11-05 06:23:00 +01:00
Alan Orth
8f7450f67a
I was very surprised how easy and fast and robust SQLite was, but in the end I realized that its UPSERT support only came in version 3.24 and both Ubuntu 16.04 and 18.04 have older versions than that! I did manage to install libsqlite3-0 from Ubuntu 18.04 cosmic on my xenial host, but that feels dirty. PostgreSQL has support for UPSERT since 9.5, not to mention the same nice LIMIT and OFFSET clauses.
13 lines
376 B
Python
13 lines
376 B
Python
from config import DATABASE_NAME
|
|
from config import DATABASE_USER
|
|
from config import DATABASE_PASS
|
|
from config import DATABASE_HOST
|
|
import psycopg2
|
|
|
|
def database_connection():
|
|
connection = psycopg2.connect("dbname={} user={} password={} host='{}'".format(DATABASE_NAME, DATABASE_USER, DATABASE_PASS, DATABASE_HOST))
|
|
|
|
return connection
|
|
|
|
# vim: set sw=4 ts=4 expandtab:
|