Skip to content

Conversation

@eradman
Copy link
Collaborator

@eradman eradman commented Nov 21, 2025

What type of PR is this?

  • Feature

Description

Allow extra PostgreSQL connection parameters to be specified, as documented in
https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS

Multiple parameters are separated by a space.

How is this tested?

  • Unit tests (pytest, jest)
  • Manually

Related Tickets & Documents

#7578

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

pg-params

@eradman eradman force-pushed the libpq-connect-options branch from 04a9886 to a8d5d96 Compare November 21, 2025 23:36
@eradman eradman changed the title pg: allow extra connection parameters to be defined PostgreSQL: allow connection parameters to be specified Nov 21, 2025
Copy link
Contributor

@yoshiokatsuneo yoshiokatsuneo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR !


def _libpq_params(configuration):
standard_params = {"user", "password", "host", "port", "dbname"}
params = psycopg2.extensions.parse_dsn(configuration.get("libpq_params", ""))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just feel it is more natural to set configuration name to like "connection_string" (or "dsn"? ) instead of "libpq_params", as that is the string set in the configuration and passed to the parse_dsn function. How do you feel ?

https://www.psycopg.org/docs/extensions.html#psycopg2.extensions.parse_dsn

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusted to use the name "dsn"--this name probably is the best because it suggests the format this string should use.

@eradman eradman force-pushed the libpq-connect-options branch from a8d5d96 to 8b4929a Compare November 25, 2025 18:28
Copy link
Contributor

@yoshiokatsuneo yoshiokatsuneo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!
I confirmed that I can connect to PostgreSQL of Redash without problem.

@eradman eradman merged commit 9d49e04 into getredash:master Nov 26, 2025
11 checks passed
@eradman eradman deleted the libpq-connect-options branch November 26, 2025 14:32
eradman added a commit to StarfishStorage/redash that referenced this pull request Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants