Skip to content

BaseConnection

relationalai.config.connections.base

Base class for connection configuration objects.

Subclasses define the connection-specific fields and implement BaseConnection.get_session to create the underlying client/session object (Snowpark, DuckDB, requests, etc.). The session is cached on the instance; call BaseConnection.clear_session_cache to force a fresh session on the next access.

Notes

Subclasses must define a type field as a typing.Literal for Pydantic discriminated unions.

Methods

.get_session()

BaseConnection.get_session() -> Any

Return the underlying session/client for this connection.

Override this in subclasses to create the connection-specific session (for example, a Snowpark session, DuckDB connection, or Session).

Returns:

  • Any - The connection-specific session/client object.

Raises:

.clear_session_cache()

BaseConnection.clear_session_cache() -> None

Clear any cached session for this connection.

After calling this, the next call to BaseConnection.get_session creates a fresh session/client.

Inheritance Hierarchy

BaseConnectionpydantic.BaseModelabc.ABC

Subclassed By