Skip to content

Configure compilation behavior

Use compilation settings to control how PyRel validates your model and query during the build step. This guide shows how to set strict mode and soft error mode in raiconfig.yaml or Python code and how to confirm the loaded values in Model.config. These settings affect compilation only. They do not change connection setup or later job execution.

  • 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.

This guide applies to the Build model and query step in the PyRel execution workflow:

1. Load and validateconfiguration2. Build modeland query3. SubmitRelationalAI job4. Run job withreasoners5. Materializeresults

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:

SettingUse it when
Strict modeYou want earlier, stricter validation during compilation.
Soft error modeYou want some type issues treated more leniently while you iterate.

Strict mode makes the PyRel compiler validate more aggressively during compilation. It is disabled by default. Enable it when you want earlier validation during compilation, such as in CI, tests, or production jobs.

When you enable strict mode, PyRel catches certain declaration and schema problems earlier:

  • References to relationships that have not been declared yet raise immediately instead of relying on implicit relationship creation.
  • Strict relationship field validation runs when relationships are defined.

Follow these steps:

  1. Set compiler.strict in raiconfig.yaml

    connections:
    # ...
    compiler:
    strict: true
  2. Inspect the parsed config

    from relationalai.semantics import Model
    m = Model("MyModel")
    print(m.config.compiler.strict)

    A printed value of True confirms that PyRel loaded the strict-mode setting from your config.

Soft error mode treats compiler type errors as warnings instead of failures. It is disabled by default, so type errors fail compilation unless you turn it on. Enable it when you’re iterating quickly in notebooks or exploratory work and want compilation to continue while you fix types.

Do the following:

  1. Set compiler.soft_type_errors in raiconfig.yaml

    connections:
    # ...
    compiler:
    soft_type_errors: true
  2. Inspect the parsed config

    from relationalai.semantics import Model
    m = Model("MyModel")
    print(m.config.compiler.soft_type_errors)

    A printed value of True confirms that PyRel loaded the soft error mode setting from your config.