Before you run the Python script in the Snowflake tool, ensure that your Python environment contains the following libraries:
•requests
•json
•time
If these libraries are not installed, you can install them using the following command:
./<Latest AI Agent Runtime service version>/pythonRuntime/python/bin/pip install requests json time
To configure the Snowflake tool, perform the following steps:
1Open the Snowflake_Tool tool connection.
2On the Code tab, uncomment the configuration block and enter the following property values within double quotes:
- SNOWFLAKE_ACCOUNT_IDENTIFIER
- SNOWFLAKE_USERNAME
- SNOWFLAKE_PROGRAMMATIC_ACCESS_TOKEN
The following snippet shows a sample configuration block:
# --- Configuration --- ENV_FILE = ".env" # After first run you need remove this 'set_key' block #set_key(ENV_FILE, "SNOWFLAKE_ACCOUNT_IDENTIFIER", "") # e.g., "your_account.us-east-1" #set_key(ENV_FILE, "SNOWFLAKE_USERNAME", "") # Add your Snowflake username here #set_key(ENV_FILE, "SNOWFLAKE_PROGRAMMATIC_ACCESS_TOKEN", "") # Programmatic access token for authentication
After the initial run, you can remove these values.
Alternatively, you can manually add these values to your environment variables.
3On the Input Parameters tab, enter values for the following parameters to execute an SQL query:
- SQL_QUERY_TO_RUN. The SQL statement to execute.
- SNOWFLAKE_WAREHOUSE. The virtual warehouse that runs the query and allocates compute resources.
- SNOWFLAKE_DATABASE. The target database for query execution.
- SNOWFLAKE_SCHEMA. The schema that contains the relevant database objects.
You can specify these values as defaults or provide them for each query.