In this quickstart, we'll use RelationalAI — a Native App available in the Snowflake Marketplace — to run community detection algorithms. The sample data represent food-truck orders, and we'll use them to identify groups of customers who probably know each other. This allows us to build a social graph and interact with groups of related customers.

What Is RelationalAI?

RelationalAI is a cloud-native platform that enables organizations to streamline and enhance decisions with intelligence. RelationalAI extends Snowflake with native support for an expanding set of AI workloads (e.g., graph analytics, rule-based reasoning, and optimization), all within your Snowflake account, offering the same ease of use, scalability, security, and governance.

Users can build a knowledge graph using Python and materialize it on top of their Snowflake data, which are shared with the RelationalAI app through Snowflake Streams. Insights can be written to Snowflake tables and shared across the organization.

What You'll Learn

What You'll Need

What You'll Build

In addition to your Snowflake account setup, follow the steps below to set up a local installation of Python with Jupyter Lab and the RelationalAI Python library.

RelationalAI Config File

After installing the relationalai package, you will need to set up a RAI configuration with the Snowflake credenrtials you want to use (similar to the configuration for Snowflake CLI).

Run rai init from your terminal and follow the prompts to enter your credentials and other configuration data:

RAI Init

  1. Choose Snowflake as your host platform.
  2. Select a profile from ~/.snowflake/connections.toml if you have one, or enter your username, password, and Account ID otherwise.
  3. Select your role rai_user that you created earlier.
  4. Select a Snowflake warehouse.
  5. Select [CREATE A NEW ENGINE] to create a new engine. Enter any name you want for the engine, for example rai_engine. (Usually you would not want to select the same engine you created above for CDC.)
  6. Select HighMem|S as the engine size.
  7. Choose the compute pool rai_compute_pool that you created above.
  8. Press Enter to accept the default profile name of default.
  1. Start Jupyter Lab with the following command:
    jupyter lab
    
    and visit the URL (something like http://localhost:8888/lab?token=XXXX) printed in the console output in your browser.
  2. Open the community-detection.ipynb file in Jupyter lab. You should see the top of the notebook:

RAI Notebook 1

  1. If you don't already have a Snowflake table called RAI_DEMO.TASTYBYTES.ORDERS, scroll down to the Appendix and run the cells in that section to insert the data for this demo into your Snowflake account.
  2. The notebook will guide you through defining a knowledge graph!

Congratulations on completing the our Community Detection using RelationalAI guide! In this Quickstart you learned

Resources