create_config
relationalai.config.config
create_config(**data) -> ConfigLoad configuration programmatically or from the highest-priority available config file source.
If keyword arguments are provided, this creates a RAIConfig
from those values. Otherwise, it tries config sources in order (first match wins):
RAI_CONFIG_FILE_PATHenv var — explicit path, skips all auto-discoveryraiconfig.yaml/raiconfig.yml(searched upward from current directory)raiconfig.toml(deprecated)~/.snowflake/config.toml~/.dbt/profiles.yml
If a source file is found but invalid, an error is raised immediately (no fallback).
Parameters
Section titled “Parameters”-
(**dataAny, default:{}) - Programmatic configuration values, passed as keyword arguments.Supported public keys are:
connections: Adictof connection definitions; seeconfig.connections.ConnectionConfigfor supported connection types and fields. (required)default_connection:str(optional; auto-selected when exactly one connection exists)profile/profiles: dict of named overrides (e.g.,dev,prod) applied on top of the base config when selected (YAML key isprofile)active_profile:str(optional; selects which profile override to apply)execution: dict ofExecutionConfigfieldsdata: dict ofDataConfigfieldscompiler: dict ofCompilerConfigfieldsmodel: dict ofModelConfigfieldsreasoners: dict ofReasonersConfigfieldsdebug: dict ofDebugConfigfieldsjobs: dict ofJobsConfigfields
The following keys are also supported, but are not intended for use by end users and should only be set if instructed to do so by RelationalAI support:
use_graph_index:bool, optional (default:True)install_mode:bool, optional (default:False)enable_otel_handler:bool, optional (default:False)
Returns
Section titled “Returns”Config- A validated config instance.
Raises
Section titled “Raises”ConfigValidationError- If the provided data or a discovered config file fails validation.ConfigFileNotFoundError- If no config files are found and no programmatic data is provided.
Examples
Section titled “Examples”Loading from a config file (auto-discovered):
>>> from relationalai.config import create_config>>> cfg = create_config()Programmatic Snowflake config using browser-based auth:
>>> from relationalai.config import create_config>>> cfg = create_config(... connections={... "sf": {... "type": "snowflake",... "authenticator": "externalbrowser",... "account": "my_account",... "warehouse": "my_warehouse",... "user": "my_user",... }... }... )>>> cfg.default_connection'sf'See snowflake for more Snowflake connection examples.
Programmatic DuckDB config:
>>> cfg = create_config(connections={"db": {"type": "duckdb", "path": ":memory:"}})>>> cfg.default_connection'db'Referenced By
Section titled “Referenced By”RelationalAI Documentation
├── Build With RelationalAI
│ └── Understand how PyRel works
│ ├── PyRel configuration overview
│ │ ├── Overview
│ │ │ └── How validation works
│ │ └── Create configuration in code
│ │ ├── Create a Config instance
│ │ └── Override file-based configuration with programmatic config
│ └── Build a semantic model
│ └── Create a model instance
│ └── Configure a model’s connection
└── Release Notes
└── Python API Release Notes
├── What’s New in Version 1.0.2
│ └── Bug Fixes
├── What’s New in Version 1.0.3
│ └── New Features and Enhancements
└── What’s New in Version 1.0.5