Skip to content

Config

relationalai.config.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.

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.

Config.active_profile: (str, optional)

Name of the profile currently applied.

Config.profiles: dict

Profile overlays keyed by name (YAML key profile).

Config.connections: dict

Named connection definitions.

Config.default_connection: (str, optional)

Connection name used when no explicit name is provided.

Config.execution: ExecutionConfig

Execution middleware configuration. See ExecutionConfig for details.

Config.data: DataConfig

Data loading and streaming configuration. See DataConfig for details.

Config.compiler: CompilerConfig

Compiler configuration. See CompilerConfig for details.

Config.model: ModelConfig

Model configuration. See ModelConfig for details.

Config.reasoners: ReasonersConfig

Reasoners configuration. See ReasonersConfig for details.

Config.debug: DebugConfig

Debug configuration. See DebugConfig for details.

Config.jobs: JobsConfig

Job execution configuration. See JobsConfig for details.

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.

Config.get_default_connection() -> ConnectionConfig

Return the connection named by Config.default_connection.

Returns:

Raises:

  • ValueError - Raised in the following cases:
    • Multiple connections exist but default_connection is not set.
    • default_connection names a connection that is not present.

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
Config.get_connection(connection_type: type[T], name: str | None = None) -> T

Return 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_type

    (type[T]) - Expected connection class.
  • name

    (str, default: None) - Connection name to look up in Config.connections. Defaults to Config.default_connection.

Returns:

  • T - The selected connection.

Raises:

  • ValueError - Raised in the following cases:
    • name is provided but no such connection exists.
    • No default connection can be determined.
    • The selected connection is not an instance of connection_type.
Config.get_session(
connection_type: (
type[SnowflakeConnection]
| type[DuckDBConnection]
| type[LocalConnection]
| None
) = None,
) -> snowflake.snowpark.Session | duckdb.DuckDBPyConnection | requests.Session

Return 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:

Returns:

  • snowflake.snowpark.Session | duckdb.DuckDBPyConnection | requests.Session - The underlying session object for the selected connection.
Configconfocal.BaseConfigabc.ABC
 config > config
├──  ConfigFromDBT
├──  ConfigFromRAIConfigToml
├──  ConfigFromSnowflake
└──  RAIConfig
.
├──  semantics > frontend > base
│   └──  Model
└──  services > reasoners > client
    └──  ReasonersClient
 config > config
└──  create_config
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