Update psycopg2 to latest version for complete PG 17 support

Update the types to match. Changes the cursor import to match the
C bindings[0].

Link: https://github.com/python/typeshed/issues/12578 [0]
Signed-off-by: Tristan Partin <tristan@neon.tech>
This commit is contained in:
Tristan Partin
2024-11-04 18:21:59 -06:00
committed by GitHub
parent 34812a6aab
commit 1e16221f82
4 changed files with 80 additions and 88 deletions

View File

@@ -18,6 +18,7 @@ if TYPE_CHECKING:
from fixtures.benchmark_fixture import NeonBenchmarker
from fixtures.neon_api import NeonApiEndpoint
from fixtures.neon_fixtures import NeonEnv, PgBin, VanillaPostgres
from psycopg2.extensions import cursor
@pytest.mark.timeout(1000)
@@ -63,9 +64,7 @@ def check_pgbench_still_running(pgbench: Popen[AnyStr], label: str = ""):
raise RuntimeError(f"{label} pgbench terminated early with return code {rc}")
def measure_logical_replication_lag(
sub_cur: psycopg2.cursor, pub_cur: psycopg2.cursor, timeout_sec: float = 600
):
def measure_logical_replication_lag(sub_cur: cursor, pub_cur: cursor, timeout_sec: float = 600):
start = time.time()
pub_cur.execute("SELECT pg_current_wal_flush_lsn()")
pub_lsn = Lsn(cast("str", pub_cur.fetchall()[0][0]))