Config
Represents a validated PyRel configuration.
Use create_config to load your raiconfig.yaml and
optionally override specific settings in code.
Instances are typically created by create_config, either from a
supported config file or programmatically. The config validates that at least one
connection exists, can auto-select default_connection when only one connection is
defined, and provides helpers such as Config.get_connection and Config.get_session.
Examples
Section titled “Examples”Load a config and override a specific setting:
>>> from relationalai.config import create_config>>> cfg = create_config(jobs={"print_progress": False})For Snowflake connections, the authenticator setting defaults to "username_password" when omitted.
Attributes
Section titled “Attributes”.active_profile
Section titled “.active_profile”Config.active_profile: (str, optional)Name of the profile currently applied.
.profiles
Section titled “.profiles”Config.profiles: dictProfile overlays keyed by name (YAML key profile).
.default_connection
Section titled “.default_connection”Config.default_connection: (str, optional)Connection name used when no explicit name is provided.
.execution
Section titled “.execution”Config.execution: ExecutionConfigExecution middleware configuration. See ExecutionConfig for details.
Config.data: DataConfigData loading and streaming configuration. See DataConfig for details.
.compiler
Section titled “.compiler”Config.compiler: CompilerConfigCompiler configuration. See CompilerConfig for details.
.model
Section titled “.model”Config.model: ModelConfigModel configuration. See ModelConfig for details.
.reasoners
Section titled “.reasoners”Config.reasoners: ReasonersConfigReasoners configuration. See ReasonersConfig for details.
.debug
Section titled “.debug”Config.debug: DebugConfigDebug configuration. See DebugConfig for details.
Config.jobs: JobsConfigJob execution configuration. See JobsConfig for details.
.tables
Section titled “.tables”Config.tables: (TablesConfig, optional)Table type defaults and per-table overrides. Controls whether model.Table()
output tables are created as iceberg or native Snowflake tables, and allows
per-table FQN remapping, external volume configuration, and schema prefixing.
See TablesConfig for details.
Methods
Section titled “Methods”.get_default_connection()
Section titled “.get_default_connection()”Config.get_default_connection() -> ConnectionConfigReturn the connection named by Config.default_connection.
Returns:
ConnectionConfig- The selected default connection.
Raises:
ValueError- Raised in the following cases:- Multiple connections exist but
default_connectionis not set. default_connectionnames a connection that is not present.
- Multiple connections exist but
Notes:
If Config.default_connection is unset and exactly one
connection is defined, that connection is returned.
Referenced By:
RelationalAI Documentation └── Build With RelationalAI └── Understand how PyRel works > Build a semantic model └── Create a model instance └── Access configuration values
.get_connection()
Section titled “.get_connection()”Config.get_connection(connection_type: type[T], name: str | None = None) -> TReturn a configured connection, optionally by name.
If name is omitted, this returns the default connection (see
Config.get_default_connection). The selected
connection is validated to be an instance of connection_type.
Parameters:
(connection_typetype[T]) - Expected connection class.
(namestr, default:None) - Connection name to look up inConfig.connections. Defaults toConfig.default_connection.
Returns:
T- The selected connection.
Raises:
ValueError- Raised in the following cases:nameis provided but no such connection exists.- No default connection can be determined.
- The selected connection is not an instance of
connection_type.
.get_session()
Section titled “.get_session()”Config.get_session( connection_type: ( type[SnowflakeConnection] | type[DuckDBConnection] | type[LocalConnection] | None ) = None,) -> snowflake.snowpark.Session | duckdb.DuckDBPyConnection | requests.SessionReturn a session for a configured connection.
When connection_type is omitted, this uses the default connection (see
Config.get_default_connection). When provided,
it resolves a connection of that type via Config.get_connection.
Parameters:
(connection_typetype[SnowflakeConnection] |type[DuckDBConnection] |type[LocalConnection], default:None) - Connection class to select when you have multiple connections configured.
Returns:
snowflake.snowpark.Session|duckdb.DuckDBPyConnection|requests.Session- The underlying session object for the selected connection.
Inheritance Hierarchy
Section titled “Inheritance Hierarchy”Subclassed By
Section titled “Subclassed By”config > config ├── ConfigFromDBT ├── ConfigFromRAIConfigToml ├── ConfigFromSnowflake └── RAIConfig
Used By
Section titled “Used By”. ├── semantics > frontend > base │ └── Model └── services > reasoners > client └── ReasonersClient
Returned By
Section titled “Returned By”config > config └── create_config
Referenced By
Section titled “Referenced By”RelationalAI Documentation
└── Build With RelationalAI
└── Understand how PyRel works
├── PyRel configuration overview
│ ├── Overview
│ │ └── How validation works
│ ├── Load configuration from files
│ │ ├── How file discovery works
│ │ └── Create a raiconfig.yaml file
│ └── Configure Snowflake authentication
│ └── Clear the session cache
└── Build a semantic model
└── Create a model instance
└── Access configuration values