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

Chore: Remove deprecated pyscopg v2 (pyscopg2) #532

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
11 changes: 9 additions & 2 deletions airbyte/_processors/sql/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import functools

from overrides import overrides
from sqlalchemy import URL

from airbyte._util.name_normalizers import LowerCaseNormalizer
from airbyte._writers.jsonl import JsonlWriter
Expand All @@ -28,9 +29,15 @@ class PostgresConfig(SqlConfig):
@overrides
def get_sql_alchemy_url(self) -> SecretString:
"""Return the SQLAlchemy URL to use."""
return SecretString(
f"postgresql://{self.username}:{self.password}@{self.host}:{self.port}/{self.database}"
url = URL.create(
drivername="postgresql+psycopg",
username=self.username,
password=self.password,
host=self.host,
port=self.port, # defaults to 5432
database=self.database,
)
return SecretString(str(url))

@overrides
def get_database_name(self) -> str:
Expand Down
Loading
Loading