Skip to content
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

Fix FATAL: unsupported startup parameter: options #2176

Merged
merged 2 commits into from
Feb 20, 2025
Merged
Changes from all commits
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
34 changes: 24 additions & 10 deletions soda/postgres/soda/data_sources/postgres_data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,30 @@ def connect(self):
self.logs.debug(
f'Postgres connection properties: host="{self.host}", port="{self.port}", database="{self.database}", user="{self.username}", options="{options}", connection_timeout="{self.connection_timeout}"'
)
self.connection = psycopg2.connect(
user=self.username,
password=self.password,
host=self.host,
port=self.port,
connect_timeout=self.connection_timeout,
database=self.database,
options=options,
sslmode=self.sslmode,
)
try:
self.connection = psycopg2.connect(
user=self.username,
password=self.password,
host=self.host,
port=self.port,
connect_timeout=self.connection_timeout,
database=self.database,
options=options,
sslmode=self.sslmode,
)
except psycopg2.OperationalError as e:
if "unsupported startup parameter: options" in str(e):
self.connection = psycopg2.connect(
user=self.username,
password=self.password,
host=self.host,
port=self.port,
connect_timeout=self.connection_timeout,
database=self.database,
sslmode=self.sslmode,
)
else:
raise e
else:
raise ConnectionError(f"Invalid postgres connection properties: invalid host: {self.host}")
return self.connection
Expand Down
Loading