# The reST default role (used for this markup: `text`) to use for all documents.
default_role = "obj"
-intersphinx_mapping = {"py": ("https://docs.python.org/3", None)}
+intersphinx_mapping = {
+ "py": ("https://docs.python.org/3", None),
+ "pg2": ("https://www.psycopg.org/docs/", None),
+}
type you should check the :ref:`Adaptation` topic.
+Copy is no more file-based
+--------------------------
+
+`psycopg2` exposes :ref:`a few copy methods <pg2:copy>` to interact with
+PostgreSQL :sql:`COPY`. The interface doesn't make easy to load
+dynamically-generated data to the database.
+
+There is now a single `~psycopg3.Cursor.copy()` method, which is similar to
+`~cursor.copy_expert()`, which accepts parameters like `!execute()` and
+returns an object to read/write data, block-wise or record-wise. The different
+usage pattern also enables :sql:`COPY` to be used in async interactions.
+
+See :ref:`copy` for the details.
+
+
Other differences
-----------------
f.write(data)
Asynchronous operations are supported using the same patterns on an
-`AsyncConnection`.
+`AsyncConnection`. For instance, if `!f` is an object supporting an
+asynchronous `!read()` method and returning :sql:`COPY` data, a fully-async
+copy operation could be:
+
+.. code:: python
+
+ async with (await cursor.copy("COPY data FROM STDIN")) as copy:
+ data = await f.read()
+ if not data:
+ break
+
+ await copy.write(data)
Binary data can be produced and consumed using :sql:`FORMAT BINARY` in the
:sql:`COPY` command: see :ref:`binary-data` for details and limitations.