From 23510740148e72234cda5bb44616f7cf41a5b392 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sun, 1 May 2022 14:35:02 +0200 Subject: [PATCH] refactor: send only once per stream No need to do it at every row, probably entirely wrong. However this is not the cause of the slowness reported in #286. --- psycopg/psycopg/cursor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/psycopg/psycopg/cursor.py b/psycopg/psycopg/cursor.py index c32ef0309..0e549e084 100644 --- a/psycopg/psycopg/cursor.py +++ b/psycopg/psycopg/cursor.py @@ -340,9 +340,9 @@ class BaseCursor(Generic[ConnectionType, Row]): self._execute_send(pgq, binary=binary, no_pqexec=True) self._pgconn.set_single_row_mode() self._last_query = query + yield from send(self._pgconn) def _stream_fetchone_gen(self, first: bool) -> PQGen[Optional["PGresult"]]: - yield from send(self._pgconn) res = yield from fetch(self._pgconn) if res is None: return None -- 2.47.2