Configure results access
Configure how PyRel returns query results to Python. This guide explains the Materialize results step in the PyRel execution workflow and shows how to choose the download URL type for returned results.
- 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.
- You already have a valid PyRel connection configured. The examples on this page assume PyRel can load that connection.
How results access works
Section titled “How results access works”This guide applies to the Materialize results step in the PyRel workflow:
When you materialize results back to Python, PyRel temporarily stores them in a Snowflake stage. PyRel then returns a URL that your client can use to download those staged results.
The machine that fetches the data must be able to reach the URL PyRel returns. If you want to export results to Snowflake tables instead of returning them to Python, see Query a model.
Set the download URL type
Section titled “Set the download URL type”The data.download_url_type setting can be set to one of two values:
- Use
internalwhen the machine downloading the results can reach Snowflake-internal URLs. - Use
externalwhen the downloader needs a URL it can reach outside that network path.
To set the URL type:
-
Set
data.download_url_typeinraiconfig.yaml:connections:# ...data:download_url_type: external -
Check the configured value:
from relationalai.semantics import Modelm = Model("MyModel")print(m.config.data.download_url_type) # should print "external"
Set data.download_url_type using DataConfig or a plain Python dict.
These examples assume you already have a valid connection configured.
-
Set the value with a typed config class:
from relationalai.config import DataConfig, create_configfrom relationalai.semantics import Modelcfg = create_config(data=DataConfig(download_url_type="external"))m = Model("MyModel", config=cfg)print(m.config.data.download_url_type) # should print "external" -
Alternatively, set the value with a dict:
from relationalai.config import create_configfrom relationalai.semantics import Modelcfg = create_config(data={"download_url_type": "external"})m = Model("MyModel", config=cfg)print(m.config.data.download_url_type) # should print "external"