Managing RAI Resources
Learn about RAI resources and how to manage them from Snowflake using the SQL Library for Snowflake.
Introduction
What are RAI Resources?
There are two main RAI resources: RAI databases and RAI engines.
RAI databases are the core elements of the RAI Integration Services storage layer. RAI databases function very much like SQL databases because the Relational Knowledge Graph System (RKGS) is built with the same principles as a relational database management system (RDMS).
RAI engines are the computational heart of the RKGS, where graph algorithms and business rules are evaluated. They are analogous to warehouses (opens in a new tab) in Snowflake.
RAI resources are case-sensitive, unlike Snowflake resources.
Is a RAI Data Stream a RAI Resource?
A RAI data stream creates a change-data-capture (CDC) pipeline from a Snowflake data object (table or view) to a RAI data object (a base relation). This RAI data object has the same characteristics as a materialized view and you can think of it as such. Neither data objects are considered a resource, but rather are located in a storage resource: a database.
Is a Graph a RAI Resource?
Similar to the RAI data stream, a graph is a RAI data object that “lives” inside a database. It is not considered a resource by itself.
Using RAI resources
Users can select RAI resources via the SQL Library for Snowflake procedures use_rai_database
and use_rai_engine
.
CALL RAI.use_rai_database('<rai_database_name>');
CALL RAI.use_rai_engine('<rai_engine_name>');
In doing so, you’re setting a context for subsequent queries that require RAI resources.
This is analogous to the USE
(opens in a new tab) command in SQL.
You can check your RAI context by executing the following query:
SELECT RAI.current_rai_database();
SELECT RAI.current_rai_engine();
See RAI Context for more details.
Permission Requirements
Everyone with access to the SQL Library for Snowflake, and in particular
every member of the <integration_user_role>
role, which owns the SQL Library for Snowflake, can create, delete, and use RAI resources.
The permissions for whether or not a user can use or manage RAI resources depends solely on the permissions granted to the RAI OAuth client the SQL Library for Snowflake is using via the RAI integration.
Managing Databases
The SQL Library for Snowflake includes functionality for managing RAI databases using the RAI Integration Services for Snowflake.
Functionality | SQL Function | Description |
---|---|---|
Create | create_rai_database | Create a RAI database. |
Delete | delete_rai_database | Delete a RAI database. |
Get info | get_rai_database | Retrieve information about a RAI database. |
Set context | use_rai_database | Select a RAI database. |
Get context | current_rai_database | Return the current RAI database. |
Managing Engines
The SQL Library for Snowflake includes functionality for managing RAI engines using the RAI Integration Services for Snowflake.
Functionality | SQL Function | Description |
---|---|---|
Create | create_rai_engine | Create a RAI engine. |
Delete | delete_rai_engine | Delete a RAI engine. |
Get info | get_rai_engine | Retrieve information about a RAI engine. |
Set context | use_rai_engine | Select a RAI engine. |
Get context | current_rai_engine | Return the current RAI engine. |
See Also
For more information on configuring and managing the RAI integration for Snowflake, check out the RAI Integration guide.