Skip to content

Make connection command-line parameters optional #156

Closed
@captaincoordinates

Description

It is not currently possible to connect to RDS Proxy using pypgstac due to its use of command-line parameters. Connection attempts fail with

connection to server at "...rds.amazonaws.com" (IP), port 5432 failed: FATAL: Feature not supported: RDS Proxy currently doesn’t support command-line options.

I've also seen a similar error when working with pgbouncer.

I had to override the PgstacDB class with the following to make this work

class _ProxyCompatiblePgstacDB(PgstacDB):
    def get_pool(self) -> ConnectionPool:
        if self.pool is None:  # type: ignore
            self.pool = ConnectionPool(
                conninfo=self.dsn,
                min_size=pypgstac_settings.db_min_conn_size,
                max_size=pypgstac_settings.db_max_conn_size,
                max_waiting=pypgstac_settings.db_max_queries,
                max_idle=pypgstac_settings.db_max_idle,
                num_workers=pypgstac_settings.db_num_workers,
            )
        return self.pool

    def connect(self) -> Connection:
        connection = super().connect()
        connection.execute("set search_path = pgstac,public")
        return connection

Perhaps there can be a configuration option, or a variation on the above, to avoid always attempting to send command-line options.

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