BaseConnection
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.
Subclasses must define a type field as a typing.Literal for Pydantic discriminated unions.
Methods
Section titled “Methods”.get_session()
Section titled “.get_session()”BaseConnection.get_session() -> AnyReturn 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:
NotImplementedError- Always raised byBaseConnection.
.clear_session_cache()
Section titled “.clear_session_cache()”BaseConnection.clear_session_cache() -> NoneClear any cached session for this connection.
After calling this, the next call to BaseConnection.get_session creates a fresh
session/client.
Inheritance Hierarchy
Section titled “Inheritance Hierarchy”Subclassed By
Section titled “Subclassed By”config > connections ├── duckdb │ └── DuckDBConnection ├── local │ └── LocalConnection └── snowflake ├── ExternalBrowserAuth ├── JWTAuth ├── OAuthAuth ├── ProgrammaticAccessTokenAuth ├── SnowflakeConnectionBase ├── UsernamePasswordAuth └── UsernamePasswordMFAAuth
Referenced By
Section titled “Referenced By”RelationalAI Documentation └── Build With RelationalAI └── Understand how PyRel works > Configure PyRel ├── Overview │ └── How database sessions are managed └── Configure snowflake auth └── Clear the session cache to create a fresh session