Configure results access
You can configure whether or not PyRel query results can be accessed from outside your Snowflake account’s internal network by setting the data.download_url_type field in your configuration.
This guide explains how results access works, when you might need to change the URL type, and how to set that preference in raiconfig.yaml or Python code.
- 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 a query result, the results are temporarily stored in a Snowflake stage and must be downloaded from there to your Python client. PyRel returns a URL that your client can use to download the results from that stage.
For the download to succeed, the machine that fetches the results must be able to reach the URL PyRel returns. You can configure the URL type PyRel returns for query result downloads to allow external access when needed, or ensure that only internal URLs are returned when the client is running on your Snowflake account’s internal network.
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"