help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) || true
-.PHONY: help env Makefile
+serve:
+ PSYCOPG3_IMPL=python sphinx-autobuild . _build/html/
+
+.PHONY: help serve env Makefile
env: .venv
.. index:: asyncio
+.. _async:
+
Async operations
================
`!psycopg3` presents a familiar interface for everyone who has used
`!psycopg2` or any other `DB API 2.0`__ database adapter, but allows to use
-more modern PostgreSQL and Python features, such as `asyncio` support,
-server-side parameters binding, binary communication, a better integration of
-the COPY support.
+more modern PostgreSQL and Python features, such as:
+
+- :ref:`asynchronous support <async>`
+- :ref:`server-side parameters binding <server-side-binding>`
+- :ref:`binary communication <binary-data>`
+- :ref:`a great integration of the COPY support <copy>`
+- :ref:`direct access to the libpq functionalities <psycopg3.pq>`
.. _Python: https://www.python.org/
.. _PostgreSQL: https://www.postgresql.org/
.. __: https://www.python.org/dev/peps/pep-0249/
+Documentation
+=============
+
.. toctree::
:maxdepth: 1
- :caption: Contents:
basic/index
advanced/index
- pass parameters in binary with ``%b``
- return parameters in binary with `!cursor(format=BINARY)`
-
+.. _psycopg3.pq:
+
`pq` -- Libpq wrapper module
============================
.. autofunction:: error_message
-Objects
--------
+Objects wrapping libpq structures and functions
+-----------------------------------------------
+
+.. admonition:: TODO
-TODO: finish documentation
+ finish documentation
.. autoclass:: PGconn()
:members:
def error_message(obj: Union[PGconn, PGresult], encoding: str = "utf8") -> str:
"""
- Return an error message from a PGconn or PGresult.
+ Return an error message from a `PGconn` or `PGresult`.
- The return value is a str (unlike pq data which is usually bytes): use
- the connection encoding if available, otherwise the *encoding* parameter
- as a fallback for decoding. Don't raise exception on decode errors.
+ The return value is a `!str` (unlike pq data which is usually `!bytes`):
+ use the connection encoding if available, otherwise the *encoding*
+ parameter as a fallback for decoding. Don't raise exceptions on decoding
+ errors.
"""
bmsg: bytes