Skip to content

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.

FunctionalitySQL FunctionDescription
Createcreate_rai_databaseCreate a RAI database.
Deletedelete_rai_databaseDelete a RAI database.
Get infoget_rai_databaseRetrieve information about a RAI database.
Set contextuse_rai_databaseSelect a RAI database.
Get contextcurrent_rai_databaseReturn the current RAI database.

Managing Engines

The SQL Library for Snowflake includes functionality for managing RAI engines using the RAI Integration Services for Snowflake.

FunctionalitySQL FunctionDescription
Createcreate_rai_engineCreate a RAI engine.
Deletedelete_rai_engineDelete a RAI engine.
Get infoget_rai_engineRetrieve information about a RAI engine.
Set contextuse_rai_engineSelect a RAI engine.
Get contextcurrent_rai_engineReturn the current RAI engine.

See Also

For more information on configuring and managing the RAI integration for Snowflake, check out the RAI Integration guide.

Was this doc helpful?