use connection parameters instead of connect URI

This commit is contained in:
Alexey Masterov
2025-07-17 14:25:53 +02:00
parent 561083524d
commit 829cb5fe59

View File

@@ -124,7 +124,6 @@ class NeonBranch:
if "parent_timestamp" in branch["branch"]
else datetime.fromtimestamp(0, tz=UTC)
)
self.connection_uri: str | None = branch["connection_uris"][0]["connection_uri"] if "connection_uris" in branch["branch"] else None
self.connect_env: dict[str, str] | None = None
if self.connection_parameters:
self.connect_env = {
@@ -508,9 +507,9 @@ class NeonProject:
target_branch.id,
self.generate_branch_name(),
)
if target_branch.connection_uri is None:
raise RuntimeError(f"The branch {target_branch.id} does not have connection URI")
with psycopg2.connect(target_branch.connection_uri) as conn:
if not target_branch.connection_parameters:
raise RuntimeError(f"The branch {target_branch.id} does not have connection parameters")
with psycopg2.connect(**target_branch.connection_parameters) as conn:
with conn.cursor() as cur:
cur.execute("SELECT value FROM sanity_check WHERE name = 'snapsot_name'")
snapshot_name = None