]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Dropped params from Cursor.copy()
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 23 Nov 2020 08:43:56 +0000 (08:43 +0000)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 23 Nov 2020 08:43:56 +0000 (08:43 +0000)
Never tested... and they don't work.

docs/cursor.rst
psycopg3/psycopg3/cursor.py

index c60bb522efb24b56404eaca7bf02400bf629334e..245afeeda68c226b226e720f4514792547ae2ee9 100644 (file)
@@ -73,12 +73,10 @@ The `!Cursor` class
         See :ref:`query-parameters` for all the details about executing
         queries.
 
-    .. automethod:: copy(statement: Query, vars: Optional[Args]=None) -> Copy
+    .. automethod:: copy(statement: Query) -> Copy
 
         :param statement: The copy operation to execute
         :type statement: `!str`, `!bytes`, or `sql.Composable`
-        :param args: The parameters to pass to the query, if any
-        :type args: Mapping, Sequence
 
         .. note:: it must be called as ``with cur.copy() as copy: ...``
 
@@ -136,7 +134,7 @@ The `!AsyncCursor` class
 
     .. automethod:: execute(query: Query, vars: Optional[Args]=None) -> AsyncCursor
     .. automethod:: executemany(query: Query, vars_seq: Sequence[Args]) -> AsyncCursor
-    .. automethod:: copy(statement: Query, vars: Optional[Args]=None) -> AsyncCopy
+    .. automethod:: copy(statement: Query) -> AsyncCopy
 
         .. note:: it must be called as ``async with cur.copy() as copy: ...``
 
index 4a96df26b17c54494b0c08de23953ab6de69548b..f077c244a8e51877de4f9acc090c3ba005196a69 100644 (file)
@@ -500,24 +500,20 @@ class Cursor(BaseCursor["Connection"]):
             yield row
 
     @contextmanager
-    def copy(
-        self, statement: Query, vars: Optional[Params] = None
-    ) -> Iterator[Copy]:
+    def copy(self, statement: Query) -> Iterator[Copy]:
         """
         Initiate a :sql:`COPY` operation and return an object to manage it.
         """
-        with self._start_copy(statement, vars) as copy:
+        with self._start_copy(statement) as copy:
             yield copy
 
-    def _start_copy(
-        self, statement: Query, vars: Optional[Params] = None
-    ) -> Copy:
+    def _start_copy(self, statement: Query) -> Copy:
         with self._conn.lock:
             self._start_query()
             self._conn._start_query()
             # Make sure to avoid PQexec to avoid receiving a mix of COPY and
             # other operations.
-            self._execute_send(statement, vars, no_pqexec=True)
+            self._execute_send(statement, None, no_pqexec=True)
             gen = execute(self._conn.pgconn)
             results = self._conn.wait(gen)
             self._check_copy_results(results)
@@ -626,22 +622,18 @@ class AsyncCursor(BaseCursor["AsyncConnection"]):
             yield row
 
     @asynccontextmanager
-    async def copy(
-        self, statement: Query, vars: Optional[Params] = None
-    ) -> AsyncIterator[AsyncCopy]:
-        copy = await self._start_copy(statement, vars)
+    async def copy(self, statement: Query) -> AsyncIterator[AsyncCopy]:
+        copy = await self._start_copy(statement)
         async with copy:
             yield copy
 
-    async def _start_copy(
-        self, statement: Query, vars: Optional[Params] = None
-    ) -> AsyncCopy:
+    async def _start_copy(self, statement: Query) -> AsyncCopy:
         async with self._conn.lock:
             self._start_query()
             await self._conn._start_query()
             # Make sure to avoid PQexec to avoid receiving a mix of COPY and
             # other operations.
-            self._execute_send(statement, vars, no_pqexec=True)
+            self._execute_send(statement, None, no_pqexec=True)
             gen = execute(self._conn.pgconn)
             results = await self._conn.wait(gen)
             self._check_copy_results(results)