ArpePGSQL — Connection guide
Everything you can put in front of ArpePGSQL to point it at a PostgreSQL server,
in one place: the three ways to supply connection details, every option the
driver accepts, and the PostgreSQL-specific rules (TLS / sslmode, SCRAM channel
binding, integrated authentication with Kerberos on Linux and SSPI on Windows,
GSS transport encryption).
For how each authentication method works (SCRAM-SHA-256 + channel binding,
Kerberos, Windows integrated authentication, gssencmode), see
Authentication. For the licence, see
Licensing.
Three ways to connect
Every driver in the Arpeio family accepts the same three connection forms. They
can be mixed; a discrete option always wins over the same field taken from a
connection_string or a uri, regardless of the order they are set.
| Form | Option key | Grammar | Best for |
|---|---|---|---|
| Discrete options | adbc.arpepgsql.<field> | one option per field | programmatic clients, secrets kept out of a single string |
| Connection string | adbc.arpepgsql.connection_string (alias connection_string) | ADO.NET Key=Value;… | pasting an existing SQL Server / SqlClient-style string |
| Connection URI | uri | postgresql://… URL | portable tooling, copy-paste from libpq / psql / ADBC tools |
import adbc_driver_manager.dbapi as dbapi
# Discrete options
conn = dbapi.connect(driver="arpepgsql", db_kwargs={
"adbc.arpepgsql.server": "localhost",
"adbc.arpepgsql.database": "tpch",
"adbc.arpepgsql.username": "alice",
"adbc.arpepgsql.password": "<password>",
"adbc.arpepgsql.sslmode": "require",
}, autocommit=True)
# Connection string (ADO.NET grammar)
conn = dbapi.connect(driver="arpepgsql", db_kwargs={
"adbc.arpepgsql.connection_string":
"Server=localhost;Database=tpch;User ID=alice;Password=<password>",
}, autocommit=True)
# Connection URI (libpq grammar)
conn = dbapi.connect(driver="arpepgsql", db_kwargs={
"uri": "postgresql://alice:<password>@localhost:5432/tpch?sslmode=require",
}, autocommit=True)
Precedence is per field: a field taken from connection_string/uri is
applied only if no discrete adbc.arpepgsql.* option already set it.
Option reference
All options are string-typed and live under the adbc.arpepgsql.* namespace
(most also accept a short bare alias, noted below). Set them as ADBC database
options before the connection is opened. Statement/ingest options are set on the
statement — see Statement & ingest options.
Database-level vs connection-level keys
Every option on this page is a database option (db_kwargs,
AdbcDatabaseSetOption), copied to each connection when it is created. Most
adbc.arpepgsql.* names are also accepted as connection options
(conn_kwargs, AdbcConnectionSetOption), except connection_string,
trusted, login_timeout, socket_timeout, buffer_size and the licence
options, which are database-only.
A short bare alias means exactly the same as its
adbc.arpepgsql.* key and is accepted wherever that key is, with the same
validation:
| Bare key | Database level | Connection level |
|---|---|---|
server, hostname, database, username, password, port, application_name, app_name, auth_mode, sslmode, ssl_root_cert, channel_binding, encrypt, trust_server_cert, require_password_encryption, require_kerberos, gssencmode, krbsrvname, krb5_keytab, krb5_ccache, krb5_spn, krb5_principal, krb5_password, geospatial, json_extension, uuid_casing, numeric_format, numeric_special, array_lower_bound, temporal_infinity, copy_format, query_timeout | ✓ | ✓ |
trusted, connection_string, uri | ✓ | — |
Note the spelling difference for the Kerberos options: the full keys
are dotted (adbc.arpepgsql.krb5.spn), the bare aliases use an underscore
(krb5_spn), and the full key for auth_mode is adbc.arpepgsql.auth_type.
Target — where to connect
| Option | Alias | Default | Meaning |
|---|---|---|---|
adbc.arpepgsql.connection_string | connection_string | — | ADO.NET Key=Value;… string, see Connection string. Database level only. |
uri | — | — | libpq-style postgresql://… URI, see Connection URI. Database level only. |
adbc.arpepgsql.server | server, hostname | — | Host name or address. As a discrete option an IPv6 literal is given bare (::1); inside a connection_string or uri it takes the bracketed form [::1]. In a connection_string value, a tcp: prefix and a :port or ,port suffix are also accepted (db.example.com:5433, tcp:db.example.com,5433, tcp:db.example.com:5433). |
adbc.arpepgsql.port | port | 5432 | TCP port, 1..65535. |
adbc.arpepgsql.database | database | server default (the role's default DB) | Initial database. A connection sees exactly one database at a time (no cross-database queries); switch with adbc.connection.catalog. |
adbc.arpepgsql.username | username | PGUSER (required; PostgreSQL needs a role name) | Login role. |
adbc.arpepgsql.password | password | PGPASSWORD, else the password file | Password for the password-family auth methods. See PostgreSQL environment variables. |
adbc.arpepgsql.application_name | application_name, app_name | unset (not sent; server default) | Program name reported to the server (application_name GUC, pg_stat_activity.application_name). |
A server, database, username or password longer than 255 bytes, or an
ssl_root_cert path longer than 1023 bytes, is rejected with
INVALID_ARGUMENT ("… is too long"), whether it is given as an option, in a
connection string or through PGUSER / PGPASSWORD / PGSSLROOTCERT.
Authentication
Full method-by-method detail is in Authentication; the TLS / channel-binding options are under TLS & encryption options and the integrated paths under Kerberos authentication (Linux) and Integrated authentication (Windows).
| Option | Values | Meaning |
|---|---|---|
adbc.arpepgsql.username / .password | string | Password-family credentials (SCRAM-SHA-256 / MD5 / cleartext, negotiated by the server). Aliases username / password. When unset, PGUSER / PGPASSWORD / the password file are used, see PostgreSQL environment variables. |
adbc.arpepgsql.trusted | true/1/yes/sspi/SSPI, false/0/no | Integrated auth: Kerberos (GSSAPI) on Linux, the logged-in Windows identity (SSPI) on Windows. Set username to the database role to log in as; a password is rejected. Alias trusted (database level only). |
adbc.arpepgsql.auth_type | sql/SqlPassword, integrated/sspi/trusted | Selects the auth mode explicitly. Any other value (the Entra ID / certificate families) is rejected with NOT_IMPLEMENTED. Alias auth_mode. |
adbc.arpepgsql.krb5.ccache | path | Kerberos (Linux): credential cache file to use instead of the ambient one from kinit. Alias krb5_ccache. |
adbc.arpepgsql.krb5.keytab | path | Kerberos (Linux): keytab file, for service accounts that cannot run kinit. Alias krb5_keytab. |
adbc.arpepgsql.krb5.principal | name | Kerberos (Linux): client principal (e.g. alice@EXAMPLE.COM), used with krb5.password, or to pick one principal of a keytab. Alias krb5_principal. |
adbc.arpepgsql.krb5.password | string | Kerberos (Linux): password used to obtain a ticket for krb5.principal, which is then required. Alias krb5_password. |
adbc.arpepgsql.krb5.spn | SPN | Use this service principal name verbatim instead of the derived one (e.g. postgres/db.example.com@EXAMPLE.COM on Linux, POSTGRES/db.example.com on Windows). Takes precedence over krbsrvname. Alias krb5_spn. |
adbc.arpepgsql.krbsrvname | name | Replace the service part of the derived SPN: default postgres on Linux (giving postgres/<server>, as in libpq) and POSTGRES on Windows (giving POSTGRES/<server>). Ignored when krb5.spn is set. Alias krbsrvname. |
adbc.arpepgsql.require_kerberos | true / false (default) | Windows: refuse an integrated login that negotiated NTLM (or a package Windows does not report) instead of Kerberos. No effect on Linux, where only Kerberos is used. Alias require_kerberos; RequireKerberos in a connection string, require_kerberos in a URI. See Authentication → NTLM. |
adbc.arpepgsql.gssencmode | disable (default) / prefer / require | GSS transport encryption (Linux), negotiated before TLS and the login. require skips TLS entirely. The default differs from libpq's prefer. Alias gssencmode. See Authentication → GSS transport encryption. |
TLS & encryption options
Boolean options (encrypt, trust_server_cert,
require_password_encryption, require_kerberos) take true / yes / 1
or false / no / 0, in any case, at both levels. Any other
value is rejected with INVALID_ARGUMENT.
| Option | Default | Meaning |
|---|---|---|
adbc.arpepgsql.sslmode | prefer | disable / prefer / require / verify-ca / verify-full. require encrypts but does not verify the certificate, unless a root certificate is set (ssl_root_cert or PGSSLROOTCERT): then it verifies the chain, as verify-ca does (like libpq). verify-ca/verify-full always verify (and verify-full also checks the hostname). Alias sslmode. |
adbc.arpepgsql.ssl_root_cert | PGSSLROOTCERT, else ~/.postgresql/root.crt for verify-ca / verify-full, else (verify-full only) the system CA store (details) | PEM root-CA file used by verify-ca / verify-full, and by require, which then verifies the chain. verify-ca with no root certificate refuses to connect, as in libpq, and verify-full without one trusts the operating system's CA store. Alias ssl_root_cert. |
adbc.arpepgsql.channel_binding | prefer | prefer / require / disable. require enforces SCRAM-SHA-256-PLUS channel binding over TLS and refuses a PLUS-stripping downgrade. It also refuses every other method the server may ask for (cleartext, MD5, integrated authentication, or no authentication at all), as libpq does. Alias channel_binding. |
adbc.arpepgsql.encrypt | false | Compatibility bridge for the ADO.NET TLS vocabulary. With no sslmode, encrypt=true maps to verify-full, or to require when trust_server_cert=true. Given together with an sslmode, the two must agree (see Conflicting TLS settings). Prefer sslmode directly. Alias encrypt. |
adbc.arpepgsql.trust_server_cert | false | Part of the same bridge (see encrypt). Prefer sslmode directly. Alias trust_server_cert. |
adbc.arpepgsql.require_password_encryption | false | true refuses to send a cleartext or MD5 password when the transport is not encrypted, closing the downgrade path left open by sslmode=prefer. Off by default (libpq-compatible). Also available as RequirePasswordEncryption in a connection string and require_password_encryption in a URI. Alias require_password_encryption. |
⚠️ Security — the default
sslmode=prefergives no MITM protection. Like libpq,preferfalls back to plaintext when the server declines TLS, and that reply is read before TLS so it is unauthenticated. Over an untrusted network usesslmode=verify-fulland/orchannel_binding=require. See TLS &sslmodebelow.
Read-only: negotiated TLS and OpenSSL version
These options report; they cannot be set (INVALID_ARGUMENT for the
connection options, NOT_IMPLEMENTED for the database option).
| Option | Read with | Meaning |
|---|---|---|
adbc.arpepgsql.tls.version | AdbcConnectionGetOption | The TLS protocol version the connection's handshake negotiated, e.g. TLSv1.3. Empty before the connection's session opens and on a connection without TLS (sslmode=disable, prefer falling back to plaintext, GSS encryption). Reading it never opens a session. |
adbc.arpepgsql.tls.group | AdbcConnectionGetOption | The key-exchange group, e.g. X25519MLKEM768 (hybrid post-quantum ML-KEM, offered first by the released binaries and used when the server's OpenSSL is 3.5 or later) or x25519. |
adbc.arpepgsql.tls.cipher | AdbcConnectionGetOption | The cipher suite, e.g. TLS_AES_256_GCM_SHA384. |
adbc.arpepgsql.openssl_version | AdbcDatabaseGetOption | The OpenSSL built into the driver, as OpenSSL reports it: a string starting with OpenSSL 3.5 (the 3.5 LTS series). No licence or connection is needed. Compare it with an OpenSSL advisory to know whether a deployed driver is affected. |
conn.adbc_connection.get_option("adbc.arpepgsql.tls.version") # "TLSv1.3"
conn.adbc_database.get_option("adbc.arpepgsql.openssl_version") # "OpenSSL 3.5.9 ..."
With the environment variable ARPEIO_ADBC_LOG_TLS=1 the driver also prints
one line per TLS handshake to standard error, for example
arpepgsql: TLS TLSv1.3 group X25519MLKEM768 cipher TLS_AES_256_GCM_SHA384 peer db.example.com
(it can be collected through ADBC instead, see Warnings).
Timeouts & performance
| Option | Default | Meaning |
|---|---|---|
adbc.arpepgsql.login_timeout | 30 | Login budget in seconds (0 = no limit, also as Connection Timeout=0 in a connection string or connect_timeout=0 in a URI). It covers the whole login: the TCP connect, the TLS or GSS encryption handshake, authentication and startup together, so a server that accepts the connection and then stalls fails with login timed out after N s. Each address of a multi-address host gets its own budget. |
adbc.arpepgsql.socket_timeout | 0 | Per-I/O recv/send timeout in seconds (0 = none). Set it to bound a long-running or stalled query. |
adbc.arpepgsql.query_timeout | 0 | Longest a statement may run, in seconds (0 = no limit from the driver). See Query timeout. Alias query_timeout. |
adbc.arpepgsql.buffer_size | 32000 | Rows per streamed Arrow batch (per connection); also the default statement batch_size. Values above 10,000,000 are capped. 0, a negative value or a non-number (including trailing text such as 10abc) is rejected with INVALID_ARGUMENT. A batch is closed early, before the row that would take a utf8 / binary column past Arrow's 2 GiB limit. |
adbc.arpepgsql.copy_format | auto (default) / binary / text | Read-path extraction strategy. auto uses the fast binary COPY path on real PostgreSQL and falls back to the text row path for PostgreSQL-wire-compatible engines that don't emit a binary COPY stream (e.g. CedarDB), detected once per connection. binary forces binary COPY (clear error if unsupported). text always uses the text row path. Alias copy_format. Env override when the option is unset or auto: ARPEIO_ADBC_COPY_FORMAT. |
PostgreSQL-wire-compatible engines. Databases that only speak the PostgreSQL protocol (CedarDB, CockroachDB, Redshift, Materialize, …) may not implement binary
COPY TO. Inauto(the default) the driver detects this once per connection and uses the text row path, so extraction works unchanged. For best throughput on such a server, setcopy_format=textto skip the initial binary-COPYattempt.In
auto, a statement thatCOPYcannot wrap (SHOW,EXPLAIN, several statements in one string,SELECT INTO: SQLSTATE class 42 or0A000) runs on the text row path instead. Any other error, such as a cancel, astatement_timeoutor alock_timeout, is reported as is and the statement is not run a second time. An engine that rejectsCOPY ... TO STDOUTwith some other SQLSTATE needscopy_format=text.
Query timeout
The driver applies query_timeout as the server's statement_timeout, from
the connection's next statement, so the server cancels a statement that runs
longer. The time counts from when the statement reaches
the server until its last row is sent, so the time the application takes to
read the rows counts too. It covers every statement on the connection:
queries, updates, bound statements, bulk ingest and metadata calls.
- A timed-out call fails with
ADBC_STATUS_TIMEOUTand SQLSTATE57014(a result stream withETIMEDOUT), with the messagequery timed out: it ran longer than query_timeout (N s) and the server cancelled it. The connection stays usable. Inside a transaction, the timed-out statement aborts the transaction, as any failed statement does: roll back to continue. - A cancel gets the same SQLSTATE. The driver reports
ADBC_STATUS_CANCELLEDwhen the application calledAdbcStatementCancelorAdbcConnectionCancelduring the call, whatever the server'slc_messageslanguage. Otherwise it reads the server's message: the Englishcanceling statement due to user request(apg_cancel_backendfrom another session) isADBC_STATUS_CANCELLED, and anything else isADBC_STATUS_TIMEOUT. So under a translatedlc_messages, apg_cancel_backendfrom another session reads as a timeout. - With
0the driver sends nothing, so astatement_timeoutset on the server, database or role still applies. ASET statement_timeoutof your own replaces the driver's untilquery_timeoutchanges. - It is also a connection option (
adbc.arpepgsql.query_timeoutorquery_timeout, string or integer) and can be changed on an open connection: the next statement applies it, and going back to0restores the server's setting. - Values above 2147483 (about 24.8 days, PostgreSQL's maximum) are capped.
Type rendering (read path)
| Option | Values | Meaning |
|---|---|---|
adbc.arpepgsql.uuid_casing | lower (default) / upper | Hex-digit case of uuid values rendered to Arrow utf8. lower matches RFC 4122 and PostgreSQL's text output. lowercase / uppercase are accepted spellings. Alias uuid_casing. |
adbc.arpepgsql.numeric_format | decimal (default) / string | How NUMERIC columns are returned. decimal maps numeric(p,s) to decimal128 (p ≤ 38) or decimal256 (p ≤ 76) and falls back to utf8 for larger or unconstrained numeric. string returns every NUMERIC column as utf8 in PostgreSQL's text form — lossless, NaN included. Alias numeric_format. |
adbc.arpepgsql.array_lower_bound | error (default) / ignore | What to do with an array value whose lower bound is not 1, which an Arrow list cannot store. error fails the read with a message naming the column; ignore reads it as an ordinary list and drops the bound. Alias array_lower_bound. See Data types → Arrays. |
adbc.arpepgsql.numeric_special | error (default) / null | What to do when a NUMERIC NaN / ±Infinity reaches a decimal128/decimal256 column (Arrow decimals cannot represent it). error fails the read with a message naming the column; null reads the value as NULL. Ignored when numeric_format=string. Alias numeric_special. |
adbc.arpepgsql.temporal_infinity | error (default) / extreme | What to do with a date, timestamp or timestamptz holding infinity / -infinity, which Arrow date32 and timestamp cannot hold. error fails the read with a message naming the column and this option. extreme reads infinity as the largest value of the column's Arrow type and -infinity as the smallest, and writes those two values back as infinity / -infinity on ingest and bind, so a table read and ingested with the option holds the same rows. Alias temporal_infinity. See Data types → Infinite dates and timestamps. |
adbc.arpepgsql.geospatial | geoarrow.wkb (default) / wkb / binary | How PostGIS geometry/geography columns are read. geoarrow.wkb returns ISO WKB with GeoArrow metadata, wkb and binary return PostGIS's EWKB. geoarrow is accepted for geoarrow.wkb; varbinary and disable for binary. Alias geospatial. See Data types → Geospatial. |
adbc.arpepgsql.json_extension | off (default) / arrow.json | arrow.json tags json and jsonb columns with the canonical arrow.json extension on the read path and in GetTableSchema. The columns stay utf8; only the field metadata changes. Alias json_extension. See Data types → Character & binary. |
numeric_format, numeric_special, array_lower_bound and
temporal_infinity can also be changed on an open connection
(AdbcConnectionSetOption); the change applies from the next statement,
without reconnecting.
Licence
| Option | Meaning |
|---|---|
arpeio.adbc.license | Licence blob, inline (up to 8191 bytes). |
arpeio.adbc.license_file | Path to a .lic file (up to 1023 bytes, UTF-8). |
arpeio.adbc.license.status | Read-only (database GetOption); reports <state>;code=<ARROW_LIC_*>;tier=<tier>;expires=<epoch>. |
The driver also reads the shared ARPEIO_ADBC_LICENCE[_FILE] environment
variables and an arpeio_adbc.lic file next to the library. A
value longer than these limits is rejected with INVALID_ARGUMENT. Full resolution order in Licensing.
Standard ADBC connection options
These use the ADBC-standard keys (no arpepgsql namespace):
| Option | Values | Meaning |
|---|---|---|
adbc.connection.autocommit | true (default) / false | Autocommit mode: true or 1 enables it, false or 0 disables it, and any other value is rejected with INVALID_ARGUMENT. Also accepted as a database option, inherited by new connections. With false, a transaction begins with the next statement after each commit()/rollback() (manual-commit mode holds across transactions). adbc_ingest runs on the connection's session: with false it joins the open transaction and is committed or rolled back with it; with true, create, replace and create_append run their DDL and COPY in one transaction, so a failed ingest leaves no half-created table and replace keeps the old one. A statement that fails inside a transaction aborts it, as in PostgreSQL: later statements fail with SQLSTATE 25P02 until rollback(). commit() in that state rolls the transaction back and fails with INVALID_STATE and SQLSTATE 25P02 ("the transaction was rolled back, not committed") instead of reporting success, and switching autocommit on fails the same way. |
adbc.connection.catalog | database name | Switch to another database on the same server. PostgreSQL binds a session to one database, so this reconnects: temp tables, SET values and advisory locks do not carry over, and the schema becomes the new database's default; manual-commit mode carries over. Refused (INVALID_STATE) inside an open transaction or while a result set is still being read; an unknown database is NOT_FOUND. |
adbc.connection.db_schema | schema name | Current schema: checked to exist in the current database (NOT_FOUND otherwise), then applied with SET search_path TO "<schema>". |
Transaction isolation level and session read-only are not yet exposed as ADBC options on ArpePGSQL; set them from SQL (
SET TRANSACTION …,SET default_transaction_read_only) on the connection if needed.
Statement & ingest options
Set on the statement handle, not the database:
| Option | Default | Meaning |
|---|---|---|
adbc.arpepgsql.batch_size | inherits buffer_size (32000) | Rows per Arrow batch for this statement, 1..max_batch_size. |
adbc.arpepgsql.max_batch_size | 1000000 | Upper bound for batch_size; must be ≥ the current batch_size. |
adbc.ingest.target_table | — | Target table for adbc_ingest / bulk ingest. Setting it makes the statement a bulk ingest, with or without a mode, and data bound before it becomes the ingest data. |
adbc.ingest.mode | create | create / append / replace / create_append, or the long ADBC forms adbc.ingest.mode.create / .append / .replace / .create_append. Any other value is rejected with NOT_IMPLEMENTED. Unset means create: the table is created, and the ingest fails with ALREADY_EXISTS if it exists; set append to add to an existing table. Python's adbc_ingest() always sends a mode. |
adbc.ingest.target_catalog | — | Must name the connected database (current_database()). Any other value fails with NOT_IMPLEMENTED before any DDL runs, as PostgreSQL cannot write to another database: connect to that database instead. |
adbc.ingest.target_db_schema | — | Target schema for ingest. When unset, the table is created in or looked up in current_schema(), so a temp table of the same name is never written to; an empty search_path is then an error. Cannot be combined with adbc.ingest.temporary (see below). |
adbc.ingest.temporary | false | true or 1 ingests into a TEMP table; false or 0 does not. Any other value is rejected with INVALID_ARGUMENT, and the target is always pg_temp, never a permanent table of the same name. Enabling it clears an earlier target_db_schema, and a target_db_schema set after it fails the ingest with INVALID_STATE. |
Legacy bulk options & no-ops (back-compat)
Recognised so strings copied from other Arpeio drivers still load:
| Option | Default | Effect |
|---|---|---|
adbc.arpepgsql.prefetch | — | No-op. |
adbc.arpepgsql.memory_budget_mb | — | No-op: accepted with any value and ignored. A read's memory is bounded by batch_size. |
arpepgsql.bulk_batch_size | 10000000 | 1..100000000. Maximum rows per chunk sent during ingest; a per-chunk size limit is usually reached first, so this rarely needs changing. |
arpepgsql.bulk_tablock, arpepgsql.bulk_keep_identity, arpepgsql.bulk_check_constraints, arpepgsql.bulk_fire_triggers, arpepgsql.bulk_keep_nulls | — | No-ops: stored, never used. Ingest hints from other Arpeio drivers with no PostgreSQL COPY equivalent. The value must still be a boolean (true / yes / 1 or false / no / 0, any case); anything else is INVALID_ARGUMENT. |
The integer options (batch_size, max_batch_size,
arpepgsql.bulk_batch_size) reject trailing text such as 10abc with
INVALID_ARGUMENT. Any other key is rejected with
NOT_IMPLEMENTED ("Unknown statement option").
One command at a time
A connection runs one command at a time. While a result set is still being
read, any other command on the same connection (executing another statement,
ExecuteSchema, GetParameterSchema, commit(), rollback(), turning
autocommit on, setting adbc.connection.db_schema, GetObjects,
GetTableSchema, GetStatistics, ingest) returns INVALID_STATE with "a
result set is still open on this connection; read it to the end or release it
first", as libpq does. Read the stream to the end, or release it, before the
next command. Releasing a stream early keeps the connection: the driver reads
what is already in flight, then cancels the rest of the result (details
below).
With autocommit off, GetObjects, GetTableSchema and GetStatistics run
under a savepoint, so a failing catalog query (a missing table, no privilege)
is reported with its SQLSTATE and does not abort your transaction.
Releasing a result early. When a stream is released (a reader closed) before its end and the server is still sending after about 250 ms, the driver cancels the query.
- A statement that writes commits only after its last row, so a cancel undoes
it. The 250 ms wait therefore applies only to a statement that, from its
text, cannot write: one reading statement with no function call. Any other
statement, including
INSERT ... RETURNING, a data-changingWITH,SELECT f()orSELECT upper(a), gets about 2 s before the cancel. A write hidden behind a view, an operator or a::cast cannot be seen from the text, and a tail longer than 2 s is cancelled in every case. Read a result to its end when a statement's writes must be kept. - Inside a transaction (autocommit off), the cancel of a plain query (the
binary
COPYpath) is rolled back to an internal savepoint and the transaction carries on. A query with bound parameters, or one on the text row path, runs without that savepoint: the cancel aborts the transaction, as a cancelled statement does with libpq, so the driver waits about 2 s before cancelling such a query. The next statement then fails once with "current transaction is aborted: a result stream released before its end …", andcommit()fails with SQLSTATE25P02after rolling the transaction back. Callrollback()and run the transaction again; to keep it, read the result to its end.
Release order. Release every statement of a connection before the
connection itself. AdbcConnectionRelease returns
INVALID_STATE ("N statement(s) still open; release them first") while a
statement is still open, and leaves the connection usable. The Python driver
manager already refuses to close a connection with open cursors.
Metadata and catalogs. A PostgreSQL connection sees only its own database.
GetObjects and GetStatistics match their catalog pattern against
current_database(), so another catalog gives an empty result;
GetTableSchema with another catalog fails with NOT_FOUND. Without a
schema, GetTableSchema and GetStatistics look the table up through the
search_path, as an unqualified name in a query.
Connection string (ADO.NET form)
adbc.arpepgsql.connection_string accepts the ADO.NET Key=Value;… grammar:
case-insensitive keywords, quoted values, doubled-quote escapes. Both the
ADO.NET keywords (shared across the Arpeio driver family) and
the PostgreSQL / Npgsql ones (Host, Port, Username,
SSL Mode, …) are accepted, so a string copied from an Npgsql setup loads as
is. Keywords map onto the options above.
| Keyword(s) | Option |
|---|---|
Server, Host, Data Source, Address, Addr, Network Address | server: host, host:port, host,port, [ipv6], [ipv6]:port or [ipv6],port, each optionally after a tcp: prefix (tcp:host,port, tcp:host:port). An IPv6 address must be bracketed; any other protocol prefix (np:, lpc:) is rejected. |
Port | port. When Server / Host also carries a port, the two must be equal, else the string is rejected with INVALID_ARGUMENT. |
Database, Initial Catalog | database |
User ID, UID, User, Username | username |
Password, PWD | password |
Application Name, App | application_name |
Encrypt | encrypt |
TrustServerCertificate, Trust Server Certificate | trust_server_cert |
SSL Mode, SslMode | sslmode (libpq spellings, plus Npgsql's VerifyCA / VerifyFull; Allow maps to prefer; any case) |
Root Certificate, SSL Root Cert, SslRootCert | ssl_root_cert |
Channel Binding, ChannelBinding | channel_binding |
RequirePasswordEncryption | require_password_encryption |
Connection Timeout, Connect Timeout, Timeout | login_timeout |
Integrated Security, Trusted_Connection, Trusted Connection | trusted (SSPI/true/yes/1 → integrated, false/no/0 → SQL login) |
Authentication | SqlPassword / Sql Password → SQL login; any ActiveDirectory* value → NOT_IMPLEMENTED; anything else → INVALID_ARGUMENT |
Authenticator | winsspi / sspi / krb5 → integrated, sql → SQL login |
Krb5 Keytab File, Krb5KeytabFile, krb5-keytabfile | krb5.keytab |
Krb5 Credential Cache, Krb5CredentialCache, krb5-credcachefile | krb5.ccache |
Krb5 Principal, Krb5Principal | krb5.principal |
Krb5 Password, Krb5Password | krb5.password |
Service Principal Name, ServicePrincipalName, service_principal_name | krb5.spn |
KrbSrvName | krbsrvname |
GssEncMode | gssencmode |
RequireKerberos | require_kerberos |
temporal_infinity | temporal_infinity |
Boolean keywords (Encrypt, TrustServerCertificate, RequirePasswordEncryption,
RequireKerberos) take yes/no/true/false/1/0, case-insensitive.
Unknown keywords are rejected.
Server=localhost;Database=tpch;User ID=alice;Password=secret;Integrated Security=false
Host=db.example.com;Port=5433;Database=tpch;Username=alice;Password=secret;SSL Mode=VerifyFull
Connection URI
The standard ADBC uri option takes a libpq-style PostgreSQL URI, so a
string copied from psql, a DATABASE_URL, or other PostgreSQL ADBC tooling works
unchanged.
<scheme>://[user[:password]@]host[:port][/dbname][?key=value&…]
- Schemes (case-insensitive, equivalent):
postgresql://,postgres://, and the brandedarpepgsql://. The scheme only selects the URL grammar — it never picks the driver, sopostgresql:///postgres://never collide with another PostgreSQL ADBC driver installed alongside this one. - The path segment is the database name (as in libpq) — not an instance name.
host,userinfo, and query values are percent-decoded; a+in a query value decodes to a space. IPv6 hosts use the bracketed form:postgresql://[::1]:5432/tpch.
Query parameters (unknown or repeated parameters are rejected, as is a
parameter for a field the URI already sets, such as user next to a
user@ in the authority):
| Parameter | Option |
|---|---|
user | username |
password | password |
dbname | database (alternative spelling for callers who put it in the query) |
application_name | application_name |
connect_timeout | login_timeout |
sslmode | sslmode |
channel_binding | channel_binding |
sslrootcert | ssl_root_cert |
gssencmode | gssencmode |
krbsrvname | krbsrvname |
require_password_encryption | require_password_encryption |
require_kerberos | require_kerberos |
Parameter names are matched case-insensitively. sslmode also
takes Npgsql's VerifyCA / VerifyFull (and Allow, mapped to prefer), in
any case. Options with no URI parameter
(copy_format, numeric_*, temporal_infinity, geospatial, uuid_casing, timeouts other than
connect_timeout, the krb5.* options) are set as discrete options next to
uri.
For the ADO.NET Key=Value; form use connection_string instead of uri.
TLS & sslmode
ArpePGSQL negotiates TLS the standard PostgreSQL way, before the login. The
sslmode values mirror libpq:
sslmode | Encrypts | Verifies certificate | Verifies hostname |
|---|---|---|---|
disable | no | — | — |
prefer (default) | if the server offers it | no | no |
require | yes | no (yes when a root certificate is set) | no |
verify-ca | yes | yes (chain to a root certificate, which is required) | no |
verify-full | yes | yes (chain to a root certificate, else the system CA store) | yes |
-
prefergives no MITM protection. The server's answer to the TLS request is read before TLS, so an on-path attacker can strip it and observe the cleartext / MD5 / SCRAM-without-binding exchange. Over an untrusted network useverify-full. -
SCRAM channel binding (
channel_binding=require) binds the SCRAM exchange to the server certificate (SCRAM-SHA-256-PLUS), defeating a MITM that proxies the SASL flow even withoutverify-full. It needs TLS, so it is unavailable undersslmode=disableor active GSS encryption. -
As in libpq,
requirewith a root certificate (ssl_root_certorPGSSLROOTCERT) verifies the chain, asverify-cadoes: the connection fails if that root certificate does not sign the server's certificate. In theencrypt/trust_server_certbridge,trust_server_cert=truenever verifies. -
verify-ca/verify-fullload the CA chain fromssl_root_cert, elsePGSSLROOTCERT, else the default file~/.postgresql/root.crt(Windows:%APPDATA%\postgresql\root.crt), as libpq does. With none of them:verify-cafailsAdbcDatabaseInitwithINVALID_ARGUMENT, as in libpq. It checks no host name, so against the system CA store any certificate a public CA signed would pass. Give it a root certificate or useverify-full.verify-full(andencrypt=truewithouttrust_server_cert=true, which meansverify-full) verifies against the operating system's CA store. The host name check is what makes a public CA safe there.
See Authentication → TLS for where the system CA store is read from on each OS, the TLS version floor, SNI and the OpenSSL configuration file.
-
verify-fullchecks the certificate against the host the driver connects to. With no server configured that islocalhost, which is then also the name checked and sent as SNI. -
A root certificate file that is replaced or edited is picked up by the next connect; changes to the system CA store are picked up within 10 minutes. Every connect runs a full handshake and verifies the server certificate.
The encrypt / trust_server_cert options are a compatibility bridge for
callers who think in the ADO.NET vocabulary. With no explicit sslmode they
map to one: encrypt=true is verify-full, encrypt=true with
trust_server_cert=true is require, and anything else is the default
prefer. Prefer setting sslmode directly.
Conflicting TLS settings
When encrypt or trust_server_cert is given (as an option, a connection
string key or a URI parameter) together with an explicit sslmode, the
settings must agree. A contradictory combination fails AdbcDatabaseInit with
INVALID_ARGUMENT and a message naming both keys ("Conflicting TLS settings:
…"):
| Setting | Conflicts with sslmode |
|---|---|
encrypt=true (TLS required) | disable, prefer (and Allow, which maps to prefer) |
trust_server_cert=true (do not verify) | verify-ca, verify-full |
trust_server_cert=false (verify) | prefer, and require with no root certificate |
encrypt=false only means "TLS not required" and agrees with every sslmode.
For example Encrypt=yes;SslMode=disable and
TrustServerCertificate=true;SslMode=VerifyFull are rejected, while
Encrypt=yes;SslMode=require and Encrypt=yes;SslMode=verify-full work.
PostgreSQL environment variables and .pgpass
Settings that no option, connection string or URI gives fall back to the
standard PostgreSQL client environment, the same variables Npgsql reads. They
are read once, at AdbcDatabaseInit, and an explicit option always wins:
| Variable | Fills | Notes |
|---|---|---|
PGUSER | username | |
PGPASSWORD | password | Not used with integrated (Kerberos / SSPI) authentication. |
| password file | password | Only when no password is given and PGPASSWORD is unset. PGPASSFILE, else ~/.pgpass (Windows: %APPDATA%\postgresql\pgpass.conf). |
PGSSLROOTCERT | ssl_root_cert | |
~/.postgresql/root.crt | ssl_root_cert | Only for verify-ca / verify-full (and encrypt=true without trust_server_cert=true), when neither the option nor PGSSLROOTCERT gives one. Windows: %APPDATA%\postgresql\root.crt. Used before the system CA store. |
The password file uses libpq's format, one entry per line:
hostname:port:database:username:password
*in any of the first four fields matches anything.\escapes:and\.- Lines starting with
#are comments. - The first matching line wins.
- Matching uses the configured server, port, database and username, and is
case-sensitive. As in libpq, an unset server matches as
localhostand an unset database as the username. - On Linux a file that group or others can read is ignored, with a warning on
stderr (or in the collected warnings), as libpq does:
chmod 0600 ~/.pgpass.
PGHOST, PGPORT, PGDATABASE and PGSSLMODE are not read (Npgsql
doesn't read them either): give the server, port, database and sslmode
explicitly. PGSSLCERT / PGSSLKEY have no effect, since TLS
client-certificate authentication isn't supported.
Warnings
The driver's warnings go to standard error by default. A host that logs through its own logger can collect them through ADBC instead, with these options:
| Option | Set on | Default | Meaning |
|---|---|---|---|
arpeio.adbc.warnings_to_stderr | database (before AdbcDatabaseInit), inherited by its connections; a connection can set its own | true | Print each warning to standard error. |
arpeio.adbc.collect_warnings | database (before AdbcDatabaseInit), inherited by its connections; a connection can set its own | false | Keep each warning in a buffer, read with arpeio.adbc.warnings. |
arpeio.adbc.warnings | read-only (AdbcDatabaseGetOption / AdbcConnectionGetOption) | "" | The collected warnings, one <level>: <message> line each (<level> is warning or info), separated by \n; an empty string when there are none. Reading does not clear the buffer. |
arpeio.adbc.clear_warnings | database or connection | — | true empties the buffer. |
- What each object collects. The database collects the warnings raised by
AdbcDatabaseInit: the licence grace period and a password file ignored for its permissions. A connection collects its login warnings (TLS declined undersslmode=prefer; a cleartext password, an MD5 hash or a SCRAM exchange sent over an unencrypted link; theARPEIO_ADBC_LOG_TLShandshake line, asinfo:) and the warnings of every statement run on it. - Cap. A buffer keeps 100 lines; the last one then reads
warning: <N> more warnings dropped. Clear it to collect again. - With the defaults, warnings print to standard error as usual and nothing is
buffered. Set
collect_warnings=trueandwarnings_to_stderr=falseto route them only through ADBC.
conn = dbapi.connect(driver="arpepgsql", db_kwargs={
"uri": "postgresql://alice:<password>@db.example.com/tpch",
"arpeio.adbc.collect_warnings": "true",
"arpeio.adbc.warnings_to_stderr": "false",
})
conn.adbc_database.get_option("arpeio.adbc.warnings") # Init warnings
conn.adbc_connection.get_option("arpeio.adbc.warnings") # login and statement warnings
conn.adbc_connection.set_options(**{"arpeio.adbc.clear_warnings": "true"})
Kerberos authentication (Linux)
Set adbc.arpepgsql.auth_type=integrated (or adbc.arpepgsql.trusted=true) to
log in with a Kerberos ticket (GSSAPI) instead of a password, against a gss
line in pg_hba.conf. Set adbc.arpepgsql.username to the PostgreSQL role to
log in as; a password is rejected. Mutual authentication is always required
and enforced.
# 1. Obtain a ticket: kinit alice@EXAMPLE.COM
# 2. Connect. The ambient credential cache is used automatically:
conn = dbapi.connect(driver="arpepgsql", db_kwargs={
"adbc.arpepgsql.server": "db.example.com",
"adbc.arpepgsql.database": "mydb",
"adbc.arpepgsql.username": "alice",
"adbc.arpepgsql.auth_type": "integrated",
# optional explicit credentials:
# "adbc.arpepgsql.krb5.ccache": "/tmp/krb5cc_1000",
# "adbc.arpepgsql.krb5.keytab": "/path/to/alice.keytab",
})
A Kerberos login needs MIT Kerberos (libgssapi_krb5.so.2 and
libkrb5.so.3) on the host. On a host without them the driver still loads and
password logins work; only a Kerberos login fails, with a
message naming the package to install (krb5-libs on RHEL, Rocky and Fedora,
libgssapi-krb5-2 on Debian and Ubuntu).
The target service principal name is postgres/<server> (no port). Change the
service part with adbc.arpepgsql.krbsrvname, or set the whole SPN with
adbc.arpepgsql.krb5.spn.
GSS transport encryption (adbc.arpepgsql.gssencmode): disable (the
default, unlike libpq's prefer), prefer or require. require encrypts
the whole stream over GSSAPI and skips TLS entirely, so it cannot be combined
with sslmode=require / verify-ca / verify-full, and SCRAM channel binding
is unavailable (plain SCRAM still works inside the encrypted stream). Linux
only.
The credential modes and the gssencmode rules are detailed in
Authentication.
Integrated authentication (Windows)
This section is about the Windows driver, which authenticates through Windows SSPI. On Linux, integrated authentication uses a Kerberos ticket: see Kerberos authentication (Linux).
Set adbc.arpepgsql.auth_type=integrated (or adbc.arpepgsql.trusted=true) to
authenticate as the logged-in Windows user, with no password. Set
adbc.arpepgsql.username to the PostgreSQL role to log in as; the server checks
that your Windows identity maps to it (pg_hba.conf / pg_ident.conf). The
driver picks the SSPI package as libpq does: Kerberos for a
gss line in pg_hba.conf, Negotiate (Kerberos with NTLM fallback) for an
sspi line on a Windows server.
Mutual authentication is always required and enforced: the driver refuses a
server that reports success without completing the exchange, and refuses
password-family requests while this mode is active. Register the server's SPN
in Active Directory so Kerberos can be used, and set
adbc.arpepgsql.require_kerberos=true to refuse a login that
fell back to NTLM.
conn = dbapi.connect(driver="arpepgsql", db_kwargs={
"adbc.arpepgsql.server": "db.example.com",
"adbc.arpepgsql.database": "mydb",
"adbc.arpepgsql.username": "alice",
"adbc.arpepgsql.auth_type": "integrated",
# optional: target SPN when it differs from POSTGRES/db.example.com
# "adbc.arpepgsql.krb5.spn": "postgres/db.example.com",
})
The target service principal name is derived as POSTGRES/<server> (no port),
using the server value as given — connect by the fully qualified host name
under which the SPN is registered, not by IP address. Change the service part
with adbc.arpepgsql.krbsrvname, or set the whole SPN with
adbc.arpepgsql.krb5.spn.
See also
- Authentication — SCRAM, channel binding, Kerberos, Windows integrated authentication,
gssencmode - Data types — PostgreSQL → Arrow type mapping
- Compatibility — supported PostgreSQL versions & forks
- Troubleshooting — common connection failures
- Examples — copy-paste recipes
- Licensing — supplying your Arpeio licence