RelationalAI Native App Installation#

This guide provides a step-by-step walkthrough for installing and configuring the RelationalAI (RAI) Native App for Snowflake.

Step 1: Install the RAI Native App for Snowflake#

Log in to Snowsight as an ACCOUNTADMIN and follow these steps to install the RAI Native App:

  1. View the RelationalAI marketplace listing and fill out the access request form. During the Snowpark Container Services preview, additional steps are required to prepare your account. A RelationalAI representative will guide you through this process and notify you once access is enabled.
  2. Sign in to Snowsight once access is enabled. Navigate to Data Products > Apps in the left-hand sidebar, and find RelationalAI under Installed Apps. Click Buy to start the installation.
  3. Select a warehouse to use for the installation. This warehouse is only used for installation purposes.
  4. Enter a name for your application. The default is relationalai.
  5. Click Get to install the application. When complete, click Open to view the app.
  6. Find the shield-shaped security icon to the right of the header and click it to review and consent to the app’s required account-level privileges.
    • The EXECUTE TASK and EXECUTE MANAGED TASK privileges are required to stream data via change data capture (CDC) from Snowflake to RAI, ensuring your RAI Native App has the most up-to-date data.

Next, you’ll configure compute resources and user access to the RAI Native App using the Snowsight console.

Step 2: Share Continuous Telemetry Data#

To receive support from RelationalAI, you must opt-in to share continuous telemetry data. Telemetry is written to your account’s active event table. This telemetry contains operational information such as internal system logs or engine sizes and usage data such as model attributes or obfuscated query plan information. Customer data and personally identifiable information are not included in continuous telemetry data.

  1. Use the SHOW PARAMETERS command to determine if you have an active event table:

    SHOW PARAMETERS LIKE 'event_table' in ACCOUNT;
    

    If the event_table parameter is set, the command returns the name of the active event table.

    An empty result indicates that no event table is set. Use the following snippet to create one, replacing <db_name>, <schema_name>, and <event_table_name> with your desired values:

    USE ROLE ACCOUNTADMIN;
    CREATE DATABASE IF NOT EXISTS <db_name>;
    CREATE SCHEMA IF NOT EXISTS <db_name>.<schema_name>;
    CREATE EVENT TABLE IF NOT EXISTS <db_name>.<schema_name>.<event_table_name>;
    ALTER ACCOUNT SET EVENT_TABLE = <db_name>.<schema_name>.<event_table_name>;
    
  2. Consent to and enable sharing data with RelationalAI by running the following command:

    USE ROLE ACCOUNTADMIN;
    ALTER APPLICATION relationalai SET SHARE_EVENTS_WITH_PROVIDER = TRUE;
    

Step 3: Configure Compute Resources#

The RAI Native App requires a dedicated compute pool and warehouse to run the RAI service in Snowpark Container Services.

  1. Use the CREATE COMPUTE POOL command to create a compute pool named rai_service_pool and grant USAGE and MONITOR privileges to your RAI Native App:

    CREATE COMPUTE POOL IF NOT EXISTS rai_service_pool
        FOR APPLICATION relationalai
        MIN_NODES = 1
        MAX_NODES = 1
        AUTO_RESUME = TRUE
        AUTO_SUSPEND_SECS = 300
        INSTANCE_FAMILY = CPU_X64_S;
    GRANT USAGE, MONITOR ON COMPUTE POOL rai_service_pool TO APPLICATION relationalai;
    

    Separate compute pools are required for users to consume the RAI service via the relationalai Python package. These compute pools host RAI engines, which are the compute resources that execute RAI queries. Engines come in two sizes:

    • HighMem|S, corresponding to a HIGHMEM_X64_S instance family compute pool.
    • HighMem|M, corresponding to a HIGHMEM_X64_M instance family compute pool.

    Users must choose a compute pool when creating engines. To ensure availability, we recommend creating one compute pool for each engine size:

    -- Compute pool for 'S' engines.
    CREATE COMPUTE POOL IF NOT EXISTS rai_engine_pool_s
        FOR APPLICATION relationalai
        MIN_NODES = 1
        MAX_NODES = 10
        AUTO_RESUME = TRUE
        AUTO_SUSPEND_SECS = 300
        INSTANCE_FAMILY = HIGHMEM_X64_S;
    GRANT USAGE, MONITOR ON COMPUTE POOL rai_engine_pool_s TO APPLICATION relationalai;
    
    -- Compute pool for 'M' engines.
    CREATE COMPUTE POOL IF NOT EXISTS rai_engine_pool_m
        FOR APPLICATION relationalai
        MIN_NODES = 1
        MAX_NODES = 10
        AUTO_RESUME = TRUE
        AUTO_SUSPEND_SECS = 300
        INSTANCE_FAMILY = HIGHMEM_X64_M;
    GRANT USAGE, MONITOR ON COMPUTE POOL rai_engine_pool_m TO APPLICATION relationalai;
    
    TIP

    Adjusting the AUTO_SUSPEND_SECS parameter helps balance cost control with availability for engine provisioning. See Cost Management for details on how costs are accrued.

  2. Create the compute warehouse for the RelationalAI Service:

    CREATE WAREHOUSE IF NOT EXISTS rai_warehouse WITH
        MAX_CONCURRENCY_LEVEL = 8
        WAREHOUSE_SIZE = 'X-SMALL'
        AUTO_SUSPEND = 180
        AUTO_RESUME = TRUE
        INITIALLY_SUSPENDED = TRUE;
    GRANT USAGE ON WAREHOUSE rai_warehouse TO APPLICATION relationalai;
    

Step 4: Start the RAI service#

  1. Ensure the compute pool for the service is in the Active/Idle state:
    DESCRIBE COMPUTE POOL rai_service_pool;
    
  2. Once you have verified that the pool is ready, start the RAI service:
    CALL relationalai.app.start_service('rai_service_pool', 'rai_warehouse');
    
IMPORTANT

While RelationalAI is in preview mode, you must upgrade the application weekly after RAI releases an updated native app. Subscribe to release notes to receive notifications about new versions. See Upgrades for details on upgrading the RAI Native App.

Step 5: Install the RAI CLI (Optional)#

Although you may manage the RAI Native App using SQL procedures, the RAI command-line interface (CLI) provides a more streamlined experience for common management tasks.

The RAI CLI is included in the relationalai Python package, which supports Python 3.10 and Python 3.11. Install the relationalai package using pip or your preferred package manager:

# Create a virtual environment (recommended)
python -m venv .venv

# Activate the virtual environment
source .venv/bin/activate  # Linux/macOS
.venv\Scripts\activate     # Windows

# Upgrade pip and install the 'relationalai' package
python -m pip install --upgrade pip
python -m pip install relationalai

Besides the CLI, the relationalai package serves as the main interface for creating and managing models in RAI and accessing the advanced features of the RAI Native App. Learn more in our Getting Started guide.

Next Steps#

Now that you’ve installed and configured the RAI Native App for Snowflake, you may want to: