Configure a model
Model configuration controls how PyRel loads your model and how it treats properties you have not declared.
These settings live in the model section of your configuration.
For deployment, output, and op log settings, see Configure deployment.
This guide shows how to set them, and how to inspect the values PyRel actually used.
- Prerequisites
- 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 Install and run PyRel for instructions.
Choose which setting to change
Section titled “Choose which setting to change”Use this table to find the setting for what you want to change:
| Setting | Use it when |
|---|---|
model.implicit_properties | You want accessing an undeclared property to raise an error instead of creating it, for example before deploying to production. |
model.path | You are deploying a model and want to point PyRel at its entry point script or directory. |
deployment.public_schema | You want to choose the Snowflake schema and role a model deploys to. |
deployment.identity.internal_schema | You want to choose where PyRel stores the deployment’s own internal objects and metadata. |
deployment.schedules | You want to control when a deployed model’s outputs refresh after deployment. |
deployment.materialized | You want to choose whether the data behind deployed outputs is stored in Snowflake tables. |
deployment.incremental | You want the data behind deployed outputs stored in Snowflake dynamic tables. |
deployment.overrides | You want per-output settings or access policies for deployed outputs. |
deployment.tags | You want your own Snowflake object tags on everything a deploy creates, for cost attribution, classification, or tag-based policies. |
deployment.preserve_column_case | You want deployed Snowflake columns to preserve the capitalization of model field names. |
oplog.enabled | You want to override or explicitly declare whether rai models deploy records change history for the shared-model synchronization workflow. |
Require declared properties
Section titled “Require declared properties”By default, PyRel creates a property the first time you access it, even if you never declared it.
Set the model.implicit_properties configuration option to false to require every property to be declared before use, so that accessing an undeclared property raises an error.
This check happens when Python builds the model, including when deployment loads your model entry point.
-
Set
model.implicit_propertiesinraiconfig.yamlconnections:# ...model:implicit_properties: false -
Inspect the parsed config
from relationalai.semantics import Modelm = Model("MyModel")print(m.config.model.implicit_properties)A printed value of
Falseconfirms that PyRel loaded theimplicit_propertiessetting from your config.
Set model.implicit_properties with ModelConfig 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 ModelConfig, create_configfrom relationalai.semantics import Modelcfg = create_config(model=ModelConfig(implicit_properties=False))m = Model("MyModel", config=cfg)print(m.config.model.implicit_properties) -
Set the value with a dict
from relationalai.config import create_configfrom relationalai.semantics import Modelcfg = create_config(model={"implicit_properties": False})m = Model("MyModel", config=cfg)print(m.config.model.implicit_properties)
Each example should print False.
This confirms the configuration value, not that every property in your model has been declared.
If the value differs, check which configuration file or programmatic config you passed to Model.
If building your model then raises an undeclared-property error, correct the property name or declare it before use.
Set the model entry point
Section titled “Set the model entry point”model.path points PyRel at the script or Python package directory that defines your model, for example model.py.
It has no default (None).
Deployment and related tooling use model.path to locate your model.
For example, rai models deploy deploys the model at model.path when you do not pass an explicit --path option to the command.
Setting model.path does not import the entry point when you create a Model instance.
-
Set
model.pathinraiconfig.yamlconnections:# ...model:path: model.py -
Inspect the parsed config
from relationalai.semantics import Modelm = Model("MyModel")print(m.config.model.path)A printed value of
model.pyconfirms that PyRel loaded thepathsetting from your config.
Set model.path with ModelConfig 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 ModelConfig, create_configfrom relationalai.semantics import Modelcfg = create_config(model=ModelConfig(path="model.py"))m = Model("MyModel", config=cfg)print(m.config.model.path) -
Set the value with a dict
from relationalai.config import create_configfrom relationalai.semantics import Modelcfg = create_config(model={"path": "model.py"})m = Model("MyModel", config=cfg)print(m.config.model.path)
Each example should print model.py.
This confirms the configuration value, not that the entry point exists or loads successfully.
If the value differs, check which configuration file or programmatic config you passed to Model.
See Deploy a model to load and deploy the entry point.
Set the deployment target is now covered in Configure deployment.
Configure object name prefixes and suffixes is now covered in Configure deployment.
Configure op log recording is now covered in Configure deployment.
Use a standard op log table for a transient deployment target is now covered in Configure deployment.
Schedule output refreshes is now covered in Configure deployment.
Define a schedule is now covered in Configure deployment.
Assign outputs to schedules is now covered in Configure deployment.
Skip the deploy-time refresh is now covered in Configure deployment.
Auto-suspend test schedules is now covered in Configure deployment.
Configure deployed outputs is now covered in Configure deployment.
Choose how outputs are materialized is now covered in Configure deployment.
Configure access policies is now covered in Configure deployment.
Apply a row access policy to deployed outputs is now covered in Configure deployment.
Apply a projection policy to output columns is now covered in Configure deployment.
Apply a masking policy to output columns is now covered in Configure deployment.
Combine output policies is now covered in Configure deployment.
Check the result with consumer roles is now covered in Configure deployment.
Recover from unavailable policies is now covered in Configure deployment.
Tag deployed Snowflake objects is now covered in Configure deployment.
Preserve output column case is now covered in Configure deployment.