first commit
This commit is contained in:
12
local/db.py
Normal file
12
local/db.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
import psycopg
|
||||
from psycopg.rows import dict_row
|
||||
|
||||
def connect():
|
||||
return psycopg.connect(os.environ['DATABASE_URL'], row_factory=dict_row)
|
||||
|
||||
def initialize():
|
||||
with connect() as c:
|
||||
c.execute(Path(__file__).with_name('schema.sql').read_text())
|
||||
|
||||
Reference in New Issue
Block a user