From: Daniele Varrazzo Date: Tue, 5 Jul 2022 12:17:17 +0000 (+0100) Subject: docs(crdb): docs refinements X-Git-Tag: 3.1~49^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb510657728bf7b56eaa4ccb1be730b9c37cf19b;p=thirdparty%2Fpsycopg.git docs(crdb): docs refinements --- diff --git a/docs/api/crdb.rst b/docs/api/crdb.rst index bda619bd9..3bc781fcc 100644 --- a/docs/api/crdb.rst +++ b/docs/api/crdb.rst @@ -69,6 +69,11 @@ CockroachDB-specific objects `psycopg.Connection` subclass. + .. automethod:: is_crdb + + :param conn: the connection to check + :type conn: `~psycopg.Connection`, `~psycopg.AsyncConnection`, `~psycopg.pq.PGconn` + .. autoclass:: AsyncCrdbConnection @@ -77,11 +82,10 @@ CockroachDB-specific objects .. autoclass:: CrdbConnectionInfo - The object is returned by the `!info` attribute of `CrdbConnection` and - `AsyncCrdbConnection`. + The object is returned by the `~psycopg.Connection.info` attribute of + `CrdbConnection` and `AsyncCrdbConnection`. - The object behaves like the `!ConnectionInfo`, with the following - differences: + The object behaves like `!ConnectionInfo`, with the following differences: .. autoattribute:: vendor @@ -89,10 +93,6 @@ CockroachDB-specific objects .. autoattribute:: server_version - .. attribute:: backend_pid - - Always 0 as not reported by CockroachDB. - .. data:: adapters diff --git a/psycopg/psycopg/crdb/connection.py b/psycopg/psycopg/crdb/connection.py index bde15fa17..8f88365e8 100644 --- a/psycopg/psycopg/crdb/connection.py +++ b/psycopg/psycopg/crdb/connection.py @@ -32,7 +32,7 @@ class _CrdbConnectionMixin: cls, conn: Union[Connection[Any], AsyncConnection[Any], "PGconn"] ) -> bool: """ - Return True if the server connected to ``conn`` is CockroachDB. + Return `!True` if the server connected to ``conn`` is CockroachDB. """ if isinstance(conn, (Connection, AsyncConnection)): conn = conn.pgconn @@ -151,7 +151,7 @@ class AsyncCrdbConnection(_CrdbConnectionMixin, AsyncConnection[Row]): class CrdbConnectionInfo(ConnectionInfo): """ - `~psycopg.ConnectionInfo` subclass to get specific info on a CockroachDB database. + `~psycopg.ConnectionInfo` subclass to get info about a CockroachDB database. """ __module__ = "psycopg.crdb" @@ -165,7 +165,7 @@ class CrdbConnectionInfo(ConnectionInfo): """ Return the CockroachDB server version connected. - Return a number in the PostgreSQL format (e.g. 21.2.10 -> 210210) + Return a number in the PostgreSQL format (e.g. 21.2.10 -> 210210). """ sver = self.parameter_status("crdb_version") if not sver: