aboutsummaryrefslogtreecommitdiff
path: root/api/db.py
blob: b850a89083247390821cbb132e702ebed1e39eba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import os
import sqlite3

# open database
db_path = os.path.abspath("database/database.db")
connection = sqlite3.connect(db_path, check_same_thread=False)
#!                                    ^^^ Dit is onveilig en goede multithreading support moet nog geïmplementeerd worden

# load the sql extension used in social/search
connection.enable_load_extension(True)
connection.load_extension("./database/levenshtein.sqlext")

# sql cursor
cursor = connection.cursor()