Skip to content

Support connection pooling kwargs #263

@ddelange

Description

@ddelange

Hi 👋

We would like to migrate to dj-database-url (more precisely environs[django]), but we are currently leveraging the psycopg v3 database connection pool functionality (new in django v5.1).

Is there a generic mechanic in place to migrate the following code to the dj-database-url parse constructor?

"OPTIONS": {
    # TODO replace with ?sslmode=require in DATABASE_URL
    "sslmode": env("DJANGO_DB_SSLMODE", "require"),
    # https://www.psycopg.org/psycopg3/docs/api/pool.html#psycopg_pool.ConnectionPool    
    "pool": {
        "min_size": env.int("DJANGO_DB_POOL_MIN_SIZE", 4),
        "max_size": env.int("DJANGO_DB_POOL_MAX_SIZE", 32),
        "max_lifetime": env.int("CONN_MAX_AGE", 60 * 60),
        "max_idle": env.int("CONN_MAX_IDLE", 10 * 60),
    },
},

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions