Set connection pool and overflow limits when using SQLAlchemy

Configure the connection pool size and overflow when connecting to Cloud SQL for PostgreSQL by using SQLAlchemy.

Documentation pages that include this code sample

To view the code sample used in context, see the following documentation:

Code sample


# Pool size is the maximum number of permanent connections to keep.
"pool_size": 5,
# Temporarily exceeds the set pool_size if no connections are available.
"max_overflow": 2,
# The total number of concurrent connections for your application will be
# a total of pool_size and max_overflow.