config
Load and manage PyRel configuration.
Most projects only need the create_config function:
- Call
create_config()with arguments to auto-discover and load configuration from common sources (for exampleraiconfig.yaml/raiconfig.yml). - Or pass keyword arguments to build a configuration in code.
This package re-exports the most commonly used config and connection classes so
you can import from this package instead of importing from submodules
like config or connections.
Examples
Section titled “Examples”To load a config from a file, create a raiconfig.yaml in your project:
default_connection: sfconnections: sf: type: snowflake authenticator: username_password account: my_account warehouse: my_warehouse user: my_user password: ${SNOWFLAKE_PASSWORD}Then load it with create_config (searches upwards from the current working directory):
>>> from relationalai.config import create_config>>> cfg = create_config()>>> session = cfg.get_session(name="sf")Profiles let you define named overrides (for example, dev vs prod) on top
of a shared base config. Select which overlay to apply with active_profile.
default_connection: sfconnections: sf: type: snowflake authenticator: username_password account: my_account warehouse: base_warehouse user: my_user password: ${SNOWFLAKE_PASSWORD}
profile: dev: connections: sf: warehouse: dev_warehouse prod: connections: sf: warehouse: prod_warehouse
active_profile: devWhen you load this config with create_config, the active_profile
is applied on top of the base config so that Config.get_session creates a session using
the overrides in the active profile.
You can also build a config programmatically by passing connection definitions as plain dictionaries. For example, to create a Snowflake connection config:
>>> from relationalai.config import create_config>>> cfg = create_config(... connections={... "sf": {... "type": "snowflake",... "authenticator": "username_password",... "account": "my_account",... "warehouse": "my_warehouse",... "user": "my_user",... "password": "my_password",... }... }... )Alternatively, you can instantiate connection config classes and use them to build the config:
>>> from relationalai.config import create_config, UsernamePasswordAuth>>> cfg = create_config(... connections={... "sf": UsernamePasswordAuth(... account="my_account",... warehouse="my_warehouse",... user="my_user",... password="my_password",... )... }... )See the config and connections
submodules for more details on the available config and connection types.
- If a
raiconfig.yaml/raiconfig.ymlis not found,create_configcan fall back to other supported sources (Snowflake and DBT), converting them into the same validated config shape. See thecreate_configdocs for details.
Attributes
Section titled “Attributes”Attributes exposed by this module.
relationalai.config.config_reasoners_fields. relationalai.config.connections. SnowflakeConnectionBase. Re-exported from relationalai.config.connections.snowflake. Functions
Section titled “Functions”Functions exposed by this module.
relationalai.config.config. Classes
Section titled “Classes”Classes exposed by this module.
relationalai.config.config. raiconfig.yaml / raiconfig.yml. Re-exported from relationalai.config.config`. profiles.yml. Re-exported from relationalai.config.config`. config.toml. Re-exported from relationalai.config.config`. relationalai.config.config_fields. relationalai.config.config_fields. relationalai.config.config_fields. relationalai.config.config_fields. relationalai.config.config_fields. relationalai.config.config_fields. relationalai.config.config_reasoners_fields. relationalai.config.config_reasoners_fields. relationalai.config.config_reasoners_fields. relationalai.config.config_reasoners_fields. relationalai.config.connections.duckdb. relationalai.config.connections.snowflake. relationalai.config.connections.snowflake. relationalai.config.connections.snowflake. relationalai.config.connections.snowflake. relationalai.config.connections.snowflake. relationalai.config.connections.snowflake. relationalai.config.errors.exceptions. relationalai.config.errors.exceptions. relationalai.config.errors.exceptions. relationalai.config.errors.exceptions. relationalai.config.errors.exceptions. relationalai.config.errors.context. relationalai.config.errors.context. Modules and Subpackages
Section titled “Modules and Subpackages”Submodules and subpackages available under this namespace.
Config. Config.