Skip to main content

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 on Windows).

For how each authentication method works (SCRAM-SHA-256 + channel binding, Windows integrated authentication), 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.

FormOption keyGrammarBest for
Discrete optionsadbc.arpepgsql.<field>one option per fieldprogrammatic clients, secrets kept out of a single string
Connection stringadbc.arpepgsql.connection_string (alias connection_string)ADO.NET Key=Value;…pasting an existing SQL Server / SqlClient-style string
Connection URIuripostgresql://… URLportable tooling, copy-paste from libpq / psql / ADBC tools
Python
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 (a few 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, the timeouts, buffer_size and the licence options, which are database-only. The short bare aliases do not all work at both levels:

Bare keyDatabase levelConnection level
database, username, password, port, application_name, krbsrvname, geospatial, uuid_casing, numeric_format, numeric_special, copy_format✓✓
hostname, trusted, connection_string, uri✓—
server, app_name, auth_mode, sslmode, ssl_root_cert, channel_binding, encrypt, trust_server_cert, require_password_encryption, krb5_spn—✓

A bare key in the last row passed as a database option is rejected with NOT_IMPLEMENTED ("Unknown database option"). In db_kwargs, always use the adbc.arpepgsql.* form (for example adbc.arpepgsql.sslmode, adbc.arpepgsql.krb5.spn). Note the spelling difference for the SPN override: the database form is dotted (adbc.arpepgsql.krb5.spn), the connection-level bare form uses an underscore (krb5_spn).

Target — where to connect​

OptionAliasDefaultMeaning
adbc.arpepgsql.connection_stringconnection_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.serverhostname (database), server (connection)—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; host:port since v0.4.6).
adbc.arpepgsql.portport5432TCP port, 1..65535.
adbc.arpepgsql.databasedatabaseserver 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.usernameusernamePGUSER (required; PostgreSQL needs a role name)Login role.
adbc.arpepgsql.passwordpasswordPGPASSWORD, else the password filePassword for the password-family auth methods. See PostgreSQL environment variables.
adbc.arpepgsql.application_nameapplication_name (also app_name at connection level)unset (not sent; server default)Program name reported in the startup packet (application_name GUC, pg_stat_activity.application_name).

Authentication​

Full method-by-method detail is in Authentication; the TLS / channel-binding options are under TLS & encryption options and the integrated path under Integrated authentication (Windows).

OptionValuesMeaning
adbc.arpepgsql.username / .passwordstringPassword-family credentials (SCRAM-SHA-256 / MD5 / cleartext, negotiated by the server). Aliases username / password. When unset, PGUSER / PGPASSWORD / the password file are used (since v0.4.5), see PostgreSQL environment variables.
adbc.arpepgsql.trustedtrue/1/yes/sspi/SSPI, false/0/noIntegrated auth with the logged-in Windows identity (SSPI). Windows only — not available on Linux. Set username to the database role to log in as; a password is rejected. Alias trusted (database level only).
adbc.arpepgsql.auth_typesql/SqlPassword, integrated/sspi/trustedSelects the auth mode explicitly (integrated is Windows only). Any other value (the Entra ID / certificate families) is rejected with NOT_IMPLEMENTED (ArpePGSQL is the driver — it cannot delegate to a client library). Connection-level alias auth_mode.
adbc.arpepgsql.krb5.spnSPNIntegrated auth (Windows): use this service principal name verbatim instead of the derived POSTGRES/<server> (e.g. POSTGRES/db.example.com). Takes precedence over krbsrvname. Connection-level alias krb5_spn.
adbc.arpepgsql.krbsrvnamenameIntegrated auth (Windows): replace the service part of the derived SPN (default POSTGRES, giving POSTGRES/<server>). Ignored when krb5.spn is set. Alias krbsrvname.

TLS & encryption options​

OptionDefaultMeaning
adbc.arpepgsql.sslmodepreferdisable / prefer / require / verify-ca / verify-full, via the FEBE SSLRequest handshake. require encrypts but does not verify the certificate; only verify-ca/verify-full do (and verify-full also checks the hostname).
adbc.arpepgsql.ssl_root_certPGSSLROOTCERT, else OpenSSL's default locations (details)PEM root-CA file used by verify-ca / verify-full. PGSSLROOTCERT is read since v0.4.5.
adbc.arpepgsql.channel_bindingpreferprefer / require / disable. require enforces SCRAM-SHA-256-PLUS channel binding over TLS and refuses a PLUS-stripping downgrade.
adbc.arpepgsql.encryptfalseCompatibility bridge for the ADO.NET TLS vocabulary (true/1/yes, false/0/no). An explicit sslmode always wins; only when none is given does encrypt=true map to verify-full (or require when trust_server_cert=true). Prefer sslmode directly.
adbc.arpepgsql.trust_server_certfalsePart of the same bridge (see encrypt). Prefer sslmode directly.
adbc.arpepgsql.require_password_encryptionfalsetrue/1/yes refuses to send a cleartext or MD5 password when the transport is not TLS-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. Since v0.3.7.

⚠️ Security — the default sslmode=prefer gives no MITM protection. Like libpq, prefer falls back to plaintext when the server answers the SSLRequest with N, and that reply is read before TLS so it is unauthenticated. Over an untrusted network use sslmode=verify-full and/or channel_binding=require. See TLS & sslmode below.

Timeouts & performance​

OptionDefaultMeaning
adbc.arpepgsql.login_timeout30TCP connect budget in seconds.
adbc.arpepgsql.socket_timeout0Per-I/O recv/send timeout in seconds (0 = none). Set it to bound a long-running or stalled query.
adbc.arpepgsql.query_timeout0Per-query timeout in seconds (0 = no limit).
adbc.arpepgsql.buffer_size32000Rows per streamed Arrow batch (per connection); also the default statement batch_size. Values above 10,000,000 are capped; 0 or a non-number is ignored.
adbc.arpepgsql.copy_formatauto (default) / binary / textRead-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); the fallback is detected in-band and cached 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. Since v0.4.2.

PostgreSQL-wire-compatible engines. Databases that only speak the PostgreSQL protocol (CedarDB, CockroachDB, Redshift, Materialize, …) may not implement binary COPY TO. In auto (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, set copy_format=text to skip the initial binary-COPY attempt.

Type rendering (read path)​

OptionValuesMeaning
adbc.arpepgsql.uuid_casinglower (default) / upperHex-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_formatdecimal (default) / stringHow 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. Since v0.4.3.
adbc.arpepgsql.numeric_specialerror (default) / nullWhat 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. Since v0.4.3 — breaking: before v0.4.3 such values were silently read as NULL (binary paths) or 0 (text path); set null to restore the binary-path behaviour.
adbc.arpepgsql.geospatialgeoarrow.wkb (default) / wkb / binaryHow PostGIS geometry/geography columns are read. geoarrow is accepted for geoarrow.wkb; varbinary and disable for binary. Alias geospatial. See Data types → Geospatial.

numeric_format and numeric_special can also be changed on an open connection (AdbcConnectionSetOption); the change applies from the next query, without reconnecting.

Licence​

OptionMeaning
arpeio.adbc.licenseLicence blob, inline.
arpeio.adbc.license_filePath to a .lic file.
arpeio.adbc.license.statusRead-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. Full resolution order in Licensing.

Standard ADBC connection options​

These use the ADBC-standard keys (no arpepgsql namespace):

OptionValuesMeaning
adbc.connection.autocommittrue (default) / falseAutocommit mode (true or 1 enables it; any other value disables it). 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 since v0.4.3). Non-temporary adbc_ingest runs on its own session and commits independently of the connection's transaction; TEMP ingest runs inside it. Set true for the single-connection TRUNCATE/adbc_ingest pattern.
adbc.connection.catalogdatabase nameSwitch 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. Since v0.4.3.
adbc.connection.db_schemaschema nameCurrent 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:

OptionDefaultMeaning
adbc.arpepgsql.batch_sizeinherits buffer_size (32000)Rows per Arrow batch for this statement, 1..max_batch_size.
adbc.arpepgsql.max_batch_size1000000Upper bound for batch_size; must be ≥ the current batch_size.
adbc.arpepgsql.memory_budget_mb256Decode memory budget, 16..8192 MB.
adbc.ingest.target_table—Target table for adbc_ingest / bulk ingest.
adbc.ingest.modecreatecreate / 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.
adbc.ingest.target_catalog—Target database for ingest.
adbc.ingest.target_db_schema—Target schema for ingest. Ignored for a temporary ingest (TEMP tables live in pg_temp).
adbc.ingest.temporaryfalsetrue or 1 ingests into a TEMP table (same-session fast path); any other value means false.

Legacy bulk options & no-ops (back-compat)​

Recognised so strings copied from other Arpeio drivers still load:

OptionDefaultEffect
adbc.arpepgsql.prefetch—No-op (the double-buffered prefetch path was removed — streaming already overlaps recv with decode).
arpepgsql.bulk_batch_size100000001..100000000. Maximum rows per CopyData chunk during ingest; chunks are also flushed at ~4 MiB, which is usually reached first.
arpepgsql.bulk_tablock, arpepgsql.bulk_keep_identity, arpepgsql.bulk_check_constraints, arpepgsql.bulk_fire_triggers, arpepgsql.bulk_keep_nulls—No-ops: stored, never used. SQL-Server-era ingest hints with no PostgreSQL COPY equivalent.

Any other key is rejected with NOT_IMPLEMENTED ("Unknown statement option").


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 (inherited from ArpeMSSQL for cross-family compatibility) and, since v0.4.6, 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 Addressserver (value may be host, host:port, host,port, tcp:host[,port], or [ipv6] followed by :port / ,port; other protocol prefixes are rejected)
Portport (a port written in Server / Host wins, as in Npgsql)
Database, Initial Catalogdatabase
User ID, UID, User, Usernameusername
Password, PWDpassword
Application Name, Appapplication_name
Encryptencrypt
TrustServerCertificate, Trust Server Certificatetrust_server_cert
SSL Mode, SslModesslmode (libpq spellings, plus Npgsql's VerifyCA / VerifyFull; Allow maps to prefer; any case)
Root Certificate, SSL Root Cert, SslRootCertssl_root_cert
Channel Binding, ChannelBindingchannel_binding
RequirePasswordEncryptionrequire_password_encryption
Connection Timeout, Connect Timeout, Timeoutlogin_timeout
Integrated Security, Trusted_Connection, Trusted Connectiontrusted (SSPI/true/yes/1 → integrated (Windows only), false/no/0 → SQL login)
AuthenticationSqlPassword / Sql Password → SQL login; any ActiveDirectory* value → NOT_IMPLEMENTED; anything else → INVALID_ARGUMENT
Authenticatorwinsspi / sspi / krb5 → integrated (Windows only), sql → SQL login
Service Principal Name, ServicePrincipalName, service_principal_namekrb5.spn
KrbSrvNamekrbsrvname

Boolean keywords (Encrypt, TrustServerCertificate, RequirePasswordEncryption) take yes/no/true/false/1/0, case-insensitive. Unknown keywords are rejected. The Host, Port, Username, SSL Mode, Root Certificate and Channel Binding keywords, host:port in Server / Host, and the Trust Server Certificate spelling are new in v0.4.6; on earlier versions set sslmode, channel_binding and ssl_root_cert as discrete options or through the URI.

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​

Version

Since ArpePGSQL v0.3.6.

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 branded arpepgsql://. The scheme only selects the URL grammar — it never picks the driver, so postgresql:///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):

ParameterOption
userusername
passwordpassword
dbnamedatabase (alternative spelling for callers who put it in the query)
application_nameapplication_name
connect_timeoutlogin_timeout
sslmodesslmode
channel_bindingchannel_binding
sslrootcertssl_root_cert
krbsrvnamekrbsrvname
require_password_encryptionrequire_password_encryption

Parameter names are matched case-insensitively. Since v0.4.6, sslmode also takes Npgsql's VerifyCA / VerifyFull (and Allow, mapped to prefer), in any case. Options with no URI parameter (copy_format, numeric_*, geospatial, uuid_casing, timeouts other than connect_timeout, krb5.spn) 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 with the PostgreSQL SSLRequest handshake. The sslmode values mirror libpq:

sslmodeEncryptsVerifies certificateVerifies hostname
disableno——
prefer (default)if the server offers itnono
requireyesnono
verify-cayesyes (chain to ssl_root_cert, else OpenSSL's default locations)no
verify-fullyesyesyes
  • prefer gives no MITM protection. The server's response to SSLRequest (S = TLS, N = plaintext) 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 use verify-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 without verify-full. It needs TLS, so it is unavailable under sslmode=disable.
  • verify-ca / verify-full load the CA chain from ssl_root_cert, else PGSSLROOTCERT, else OpenSSL's default locations. Those hold no CAs on RHEL and Windows; see Authentication → TLS for what happens on each OS, the TLS version floor, SNI and the OpenSSL configuration file.

The encrypt / trust_server_cert options are a compatibility bridge for callers who think in the ADO.NET vocabulary and are mapped to sslmode only when no explicit sslmode is given. Prefer setting sslmode directly.


PostgreSQL environment variables and .pgpass​

Version

Since ArpePGSQL v0.4.5.

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:

VariableFillsNotes
PGUSERusername
PGPASSWORDpasswordNot used with integrated authentication.
password filepasswordOnly when no password is given and PGPASSWORD is unset. PGPASSFILE, else ~/.pgpass (Windows: %APPDATA%\postgresql\pgpass.conf).
PGSSLROOTCERTssl_root_cert

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.
  • On Linux a file that group or others can read is ignored, with a warning on stderr, 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.


Integrated authentication (Windows)​

Version

Since ArpePGSQL v0.2.0.

Platform

Integrated (trusted) authentication is available with the Windows driver only, through Windows SSPI. The Linux driver supports password-family authentication (SCRAM-SHA-256, MD5, cleartext) only; requesting integrated authentication on Linux fails at connect time with "Trusted/integrated authentication is unavailable".

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 uses the Windows Negotiate package and answers the server's gss or sspi pg_hba.conf method. Mutual authentication is always required and enforced: the driver refuses AuthenticationOk from a server that never completed 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.

Python
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​