Fixed how the connection was returned
This commit is contained in:
parent
f415226b76
commit
062944b57a
|
@ -4,11 +4,11 @@ import dotenv
|
||||||
import os
|
import os
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
cursor = connect()
|
cursor = connect().cursor()
|
||||||
|
# cursor.execute("SELECT * FROM DB_table WHERE id = 1")
|
||||||
|
|
||||||
|
|
||||||
def connect():
|
def connect():
|
||||||
global conn
|
|
||||||
dotenv.load_dotenv()
|
dotenv.load_dotenv()
|
||||||
conn = psycopg2.connect(
|
conn = psycopg2.connect(
|
||||||
database=os.getenv('POSTGRES_DB'),
|
database=os.getenv('POSTGRES_DB'),
|
||||||
|
@ -17,5 +17,6 @@ def connect():
|
||||||
user=os.getenv('POSTGRES_USER'),
|
user=os.getenv('POSTGRES_USER'),
|
||||||
password=os.getenv('POSTGRES_PASSWORD')
|
password=os.getenv('POSTGRES_PASSWORD')
|
||||||
)
|
)
|
||||||
|
return conn
|
||||||
|
|
||||||
main()
|
main()
|
Loading…
Reference in New Issue