I want to set connection timeout for DB connection. I have used this code
conn_string = "postgresql://username:password:2345/devstr100"
engine = create_engine(
conn_string,
connect_args={"connect_timeout":10},
pool_pre_ping=True
)
and also tried with timeout instead of connect_timeout in the code block, but getting this error.
Due to load on the PostgreSQL Database or downtime, the lambda function gives timeout and triggers repeatedly, but the request is loaded on DB for infinite time.
Database access timed out: (psycopg2.OperationalError) connection to server at "localhost" (127.0.0.1), port 2345 failed: FATAL: unrecognised configuration parameter "connect_timeout"
Even in the documentation it said to use connect_timeout
PostgreSQL version : 10 SQLAlchemy version : 1.4.46