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
Load a config and override a specific setting:
from relationalai.config import create_config
cfg = create_config(jobs={"print_progress": False})Notes
For Snowflake connections, the authenticator setting defaults to "username_password" when omitted.
Attributes
.active_profile
Config.active_profile: (str, optional)Name of the profile currently applied.
.profiles
Config.profiles: dictProfile overlays keyed by name (YAML key profile).
.connections
Config.connections: dictNamed connection definitions.
.default_connection
Config.default_connection: (str, optional)Connection name used when no explicit name is provided.
.execution
Config.execution: ExecutionConfigExecution middleware configuration. See ExecutionConfig for details.
.reasoners
Config.reasoners: ReasonersConfigReasoners configuration. See ReasonersConfig for details.
.outputs
Config.outputs: OutputsConfigSettings for the tables and relations your model produces. Use this
to customize how specific outputs are computed — for example, to
send a particular recursive relation to the logic reasoner.
See OutputsConfig for details.
.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
.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()
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()
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
Subclassed By
config > config ├── ConfigFromDBT ├── ConfigFromRAIConfigToml ├── ConfigFromSnowflake └── RAIConfig
Used By
. ├── semantics > frontend > base │ └── Model └── services > reasoners > client └── ReasonersClient
Returned By
config > config └── create_config
Referenced By
RelationalAI Documentation
└── Build With RelationalAI
└── Understand how PyRel works
├── Configure PyRel
│ ├── 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