Fixed how the connection was returned

This commit is contained in:
slashtechno 2024-06-04 09:08:15 -05:00
parent f415226b76
commit 062944b57a
Signed by: slashtechno
GPG Key ID: 8EC1D9D9286C2B17
1 changed files with 3 additions and 2 deletions

View File

@ -4,11 +4,11 @@ import dotenv
import os
def main():
cursor = connect()
cursor = connect().cursor()
# cursor.execute("SELECT * FROM DB_table WHERE id = 1")
def connect():
global conn
dotenv.load_dotenv()
conn = psycopg2.connect(
database=os.getenv('POSTGRES_DB'),
@ -17,5 +17,6 @@ def connect():
user=os.getenv('POSTGRES_USER'),
password=os.getenv('POSTGRES_PASSWORD')
)
return conn
main()