`psycopg.Connection` subclass.
+ .. automethod:: is_crdb
+
+ :param conn: the connection to check
+ :type conn: `~psycopg.Connection`, `~psycopg.AsyncConnection`, `~psycopg.pq.PGconn`
+
.. autoclass:: AsyncCrdbConnection
.. 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
.. autoattribute:: server_version
- .. attribute:: backend_pid
-
- Always 0 as not reported by CockroachDB.
-
.. data:: adapters
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
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"
"""
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: