save_config()#

relationalai
#save_config(toml_string: str, overwrite:bool = False) -> str

Validates and saves a TOML string to a raiconfig.toml file in the current working directory.

Parameters#

NameTypeDescription
toml_stringstrThe TOML string to save to the raiconfig.toml file.
overwriteboolWhether to overwrite an existing raiconfig.toml file. If False and a file already exists, a ValueError is raised. (Default: False)

Returns#

A str containing the full raiconfig.toml file contents.

Example#

Use save_config() to save a TOML string to a raiconfig.toml file:

#import relationalai as rai

rai.save_config("""
    account = "<SNOWFLAKE_ACCOUNT_ID">
    user = "<SNOWFLAKE_USERNAME>"
    password = "<SNOWFLAKE_PASSWORD>"
    role = "<SNOWFLAKE_ROLE>"
    warehouse = "<SNOWFLAKE_WAREHOUSE>"
""")

You can use save_config() to to set global configuration state in an environment, like a Snowflake notebook, which doesn’t support the creation of a raiconfig.toml file manually or via the CLI from a notebook environment.

See the Configuration guide for more information on the raiconfig.toml file and valid configuration keys.

See Also#