79153278

Date: 2024-11-03 17:35:58
Score: 0.5
Natty:
Report link

The code seems to be right. Could it be possible that you are calling to the function authenticate_user before initializing the DB?

Also I would add a try-except when creating the connection to th DB

try:
    connection_pool = psycopg2.pool.SimpleConnectionPool(
        minconn=1,
        maxconn=10,
        user=USERNAME,
        password=PASSWORD,
        host=HOST,
        port=PORT,
        database=targetDbName
    )
    #The conn will be successfully created.
    #if not, will jump to the error (and it will tell you what is failing).
except psycopg2.Error as e:
    print(f"Error creating connection pool: {e}")
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: raul sanchez