Configure compilation behavior
Compilation settings control how PyRel validates your model and query before submitting a job to the RelationalAI Native App. This guide covers what compilation means in PyRel, the settings that affect it, and how to change those settings.
- You have access to a Snowflake account with the RelationalAI Native App installed. If you are unsure, contact your Snowflake administrator.
- You have a working PyRel installation. See Set Up Your Environment for instructions.
What compilation configuration covers
Section titled “What compilation configuration covers”This guide applies to the Build model and query step in the PyRel execution workflow:
When you run PyRel, it first compiles the model and query you wrote in Python. This includes your model definitions, any materialization requirements, and the query you want to run. During this step, PyRel translates that code into a form the backend can execute and can catch validation problems early, including type errors.
Use this table to choose which setting to change:
| Setting | Use it when |
|---|---|
| Dry-run mode | You want to validate your model only without executing it. |
| Soft type errors | You want type errors treated more leniently while you iterate. |
Enable or disable dry-run mode
Section titled “Enable or disable dry-run mode”Use dry-run mode when you want PyRel to only compile your model and/or query and not execute it. It is disabled by default.
Select the tab for your preferred configuration method to see how to set it up.
-
Set
compiler.dry_runinraiconfig.yamlconnections:# ...compiler:dry_run: true -
Inspect the parsed config
from relationalai.semantics import Modelm = Model("MyModel")print(m.config.compiler.dry_run)A printed value of
Trueconfirms that PyRel loaded thedry_runsetting from your config.
Set compiler.dry_run with CompilerConfig or a plain Python dict.
These examples assume file discovery already provides a valid connection configuration.
Use one of the following approaches:
-
Set the value with a typed config class
from relationalai.config import CompilerConfig, create_configfrom relationalai.semantics import Modelcfg = create_config(compiler=CompilerConfig(dry_run=True))m = Model("MyModel", config=cfg)print(m.config.compiler.dry_run) -
Set the value with a dict
from relationalai.config import create_configfrom relationalai.semantics import Modelcfg = create_config(compiler={"dry_run": True})m = Model("MyModel", config=cfg)print(m.config.compiler.dry_run)
Enable or disable soft type errors
Section titled “Enable or disable soft type errors”Use soft type errors when you want PyRel to treat type errors more leniently while you iterate. It is disabled by default, so compilation will fail on type errors unless you turn it on.
Select the tab for your preferred configuration method to see how to set it up.
-
Set
compiler.soft_type_errorsinraiconfig.yamlconnections:# ...compiler:soft_type_errors: true -
Inspect the parsed config
from relationalai.semantics import Modelm = Model("MyModel")print(m.config.compiler.soft_type_errors)A printed value of
Trueconfirms that PyRel loaded thesoft_type_errorssetting from your config.
Set compiler.soft_type_errors with CompilerConfig or a plain Python dict.
These examples assume file discovery already provides a valid connection configuration.
Use one of the following approaches:
-
Set the value with a typed config class
from relationalai.config import CompilerConfig, create_configfrom relationalai.semantics import Modelcfg = create_config(compiler=CompilerConfig(soft_type_errors=True))m = Model("MyModel", config=cfg)print(m.config.compiler.soft_type_errors) -
Set the value with a dict
from relationalai.config import create_configfrom relationalai.semantics import Modelcfg = create_config(compiler={"soft_type_errors": True})m = Model("MyModel", config=cfg)print(m.config.compiler.soft_type_errors)