diff --git a/src/hello_postgres/__main__.py b/src/hello_postgres/__main__.py index 75f866e..a45fc7e 100644 --- a/src/hello_postgres/__main__.py +++ b/src/hello_postgres/__main__.py @@ -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() \ No newline at end of file