In order for AI Agents to generate insights you will need to provide them with read access to the SQL tables containing the unstructured text data generated by your users, such as support tickets, call transcripts, or survey responses.
Before running the SQL commands:
1. Verify your application name in Data Products > Apps
2. Identify the database and schema containing your data
3. List the tables you want to analyze
Here is how you can give access to a table:
π€ Note:
The following SQL commands typically require database admin privileges. You may need to coordinate with your data engineering team to execute these permissions.
--- Check it in Data Products > Apps. Make sure to use the correct name.
SET LANGAI_APP_NAME = 'LANGAI_APP';
--- Give the application access to the tables
GRANT USAGE ON DATABASE YOUR_DATABASE TO APPLICATION IDENTIFIER($LANGAI_APP_NAME);
GRANT USAGE ON SCHEMA YOUR_DATABASE.YOUR_SCHEMA TO APPLICATION IDENTIFIER($LANGAI_APP_NAME);
--- NOTE: Add here the additional tables you will be using when creating AI agents
GRANT SELECT ON TABLE YOUR_DATABASE.YOUR_SCHEMA.YOUR_DATABASE TO APPLICATION IDENTIFIER($LANGAI_APP_NAME);
Once your data engineering team has granted the necessary permissions, you can create an agent by setting its SQL query. Learn more about creating the AI agent here.
Alternatively, you can directly share a Snowflake view instead of a set of tables:
--- GRANT USAGE TO DATABASE AND SCHEMA AS MENTIONED ABOVE
GRANT SELECT ON VIEW YOUR_DATABASE.YOUR_SCHEMA.YOUR_DATABASE TO APPLICATION IDENTIFIER($LANGAI_APP_NAME);
If you have any question about creating and using views, please get in touch with your CSM.