File tree 3 files changed +14
-8
lines changed
3 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 16
16
CORS (app ,supports_credentials = True )
17
17
18
18
19
- app .config ['SQLALCHEMY_DATABASE_URI' ] = SupabaseInterface .get_postgres_uri ()
19
+ app .config ['SQLALCHEMY_DATABASE_URI' ] = PostgresORM .get_postgres_uri ()
20
20
app .config ['SQLALCHEMY_TRACK_MODIFICATIONS' ] = False
21
21
22
22
db .init_app (app )
Original file line number Diff line number Diff line change @@ -56,13 +56,7 @@ def get_postgres_connection():
56
56
)
57
57
return conn
58
58
59
- def get_postgres_uri ():
60
- DB_HOST = os .getenv ('POSTGRES_DB_HOST' )
61
- DB_NAME = os .getenv ('POSTGRES_DB_NAME' )
62
- DB_USER = os .getenv ('POSTGRES_DB_USER' )
63
- DB_PASS = os .getenv ('POSTGRES_DB_PASS' )
64
-
65
- return f'postgresql://{ DB_USER } :{ DB_PASS } @{ DB_HOST } /{ DB_NAME } '
59
+
66
60
67
61
def postgres_query (query ,params = None ):
68
62
conn = SupabaseInterface .get_postgres_connection ()
Original file line number Diff line number Diff line change 1
1
from db import SupabaseInterface
2
2
from models import *
3
3
from sqlalchemy import func
4
+ import os
5
+ from dotenv import load_dotenv
4
6
7
+
8
+ load_dotenv ()
5
9
class PostgresQuery :
6
10
7
11
def get_issue_query ():
@@ -81,6 +85,14 @@ def get_pr_data(dmp_issue_id):
81
85
82
86
83
87
class PostgresORM :
88
+
89
+ def get_postgres_uri ():
90
+ DB_HOST = os .getenv ('POSTGRES_DB_HOST' )
91
+ DB_NAME = os .getenv ('POSTGRES_DB_NAME' )
92
+ DB_USER = os .getenv ('POSTGRES_DB_USER' )
93
+ DB_PASS = os .getenv ('POSTGRES_DB_PASS' )
94
+
95
+ return f'postgresql://{ DB_USER } :{ DB_PASS } @{ DB_HOST } /{ DB_NAME } '
84
96
85
97
def get_issue_query ():
86
98
results = (
You can’t perform that action at this time.
0 commit comments