Skip to content

Psycopg2SqlClient: accept extra options #2755

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: devel
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Psycopg2SqlClient: accept dsn options
  • Loading branch information
nicob3y authored May 17, 2025
commit 67de1d79007344261b40722305226064f74bcd4c
6 changes: 5 additions & 1 deletion dlt/destinations/impl/postgres/sql_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ def __init__(
self.credentials = credentials

def open_connection(self) -> "psycopg2.connection":
options=f"-c search_path={self.fully_qualified_dataset_name()},public"
extra_options = self.credentials.query.get("options")
if extra_options:
options = f"{extra_options} {options}"
self._conn = psycopg2.connect(
dsn=self.credentials.to_native_representation(),
options=f"-c search_path={self.fully_qualified_dataset_name()},public",
options=options,
)
# we'll provide explicit transactions see _reset
self._reset_connection()
Expand Down
Loading