Skip to content

Step-by-Step Tutorial - Connecting IQ with Sample Data in Snowflake

This tutorial walks you through the complete journey of setting up Trust3 Cloud and using it to query your data with natural language.

Before Getting Started

  • If you haven't signed up yet, sign up for Trust3 Cloud to get started.
  • If you don't have a Snowflake account, please go here to sign-up for a free Snowflake account for the purpose of this tutorial.

Follow these steps to get started:

Overview

After signing up on Trust3 Cloud, you'll complete these key steps:

  1. Setup Sample Data in Snowflake
  2. Connect your Snowflake Account with Trust3
  3. Create an IQ Space
  4. Start asking questions with AskIQ

Step 1: Setup Sample Data in Snowflake

For this tutorial, we'll use Snowflake's built-in sample data from the SNOWFLAKE_SAMPLE_DATA database.

Access Snowflake Sample Data

Snowflake provides sample data sets in a shared database called SNOWFLAKE_SAMPLE_DATA. This database contains industry-standard benchmark data (TPC-DS and TPC-H) that's perfect for testing and learning.

1. Verify Access to Sample Data

  1. Log in to your Snowflake account
  2. Open Snowsight (Snowflake's web interface)
  3. Create a new SQL Worksheet
  4. Run the following query to check if you have access to the sample database:
SQL
SHOW DATABASES LIKE 'SNOWFLAKE_SAMPLE_DATA';

If the database appears, you're all set! If you don't see the database, ask your Snowflake administrator to grant you access. For more information, see the Snowflake Sample Data documentation.

2. Verify Access to TPCH_SF1 Schema

Check if you have access to the TPCH_SF1 schema that we'll use for this tutorial:

SQL
1
2
3
USE DATABASE SNOWFLAKE_SAMPLE_DATA;
USE SCHEMA TPCH_SF1;
SHOW TABLES;

If you can see tables like CUSTOMER, ORDERS, LINEITEM, etc., you have access and can proceed. If you get an error, ask your Snowflake administrator to grant you access to the SNOWFLAKE_SAMPLE_DATA.TPCH_SF1 schema.

3. Create Your Tutorial Database

Create a new database for this tutorial:

SQL
1
2
3
4
5
6
CREATE DATABASE IF NOT EXISTS TRUST3_SNOWFLAKE_TUTORIAL;
USE DATABASE TRUST3_SNOWFLAKE_TUTORIAL;

-- Create a schema to organize the tables
CREATE SCHEMA IF NOT EXISTS TPCH_SF1;
USE SCHEMA TPCH_SF1;

4. Copy Tables Using CTAS

For this tutorial, we'll copy all tables from the TPCH_SF1 schema using CREATE TABLE AS SELECT (CTAS). This creates actual copies of the data in your tutorial database.

Run the following commands to copy all tables:

SQL
-- Copy CUSTOMER table
CREATE TABLE CUSTOMER AS 
SELECT * FROM SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.CUSTOMER;

-- Copy LINEITEM table
CREATE TABLE LINEITEM AS 
SELECT * FROM SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.LINEITEM;

-- Copy NATION table
CREATE TABLE NATION AS 
SELECT * FROM SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.NATION;

-- Copy ORDERS table
CREATE TABLE ORDERS AS 
SELECT * FROM SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.ORDERS;

-- Copy PART table
CREATE TABLE PART AS 
SELECT * FROM SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.PART;

-- Copy PARTSUPP table
CREATE TABLE PARTSUPP AS 
SELECT * FROM SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.PARTSUPP;

-- Copy REGION table
CREATE TABLE REGION AS 
SELECT * FROM SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.REGION;

-- Copy SUPPLIER table
CREATE TABLE SUPPLIER AS 
SELECT * FROM SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.SUPPLIER;

5. Verify Your Data

Verify that all tables were created successfully:

SQL
USE SCHEMA TRUST3_SNOWFLAKE_TUTORIAL.TPCH_SF1;
SHOW TABLES;

You should see all 8 tables: - CUSTOMER - LINEITEM - NATION - ORDERS - PART - PARTSUPP - REGION - SUPPLIER

6. Explore Sample Tables

Let's take a quick look at a few tables to confirm everything is working:

SQL
-- Check customer count
SELECT COUNT(*) AS total_customers FROM CUSTOMER;

-- View sample customer data
SELECT * FROM CUSTOMER LIMIT 5;

-- Check order count
SELECT COUNT(*) AS total_orders FROM ORDERS;

-- View sample order data
SELECT * FROM ORDERS LIMIT 5;

Data Ready

Your tutorial database is now set up with sample data! You can now proceed to connect this database to Trust3 Cloud in the next step.


Step 2: Connect your Snowflake Account with Trust3

Connect your Snowflake instance to Trust3 Cloud so that Trust3 can access your data.

Prerequisites

Before connecting, make sure you have:

  • Your Snowflake account identifier (format: MYORG-ACCOUNT123)
  • A Snowflake username with read permissions on your databases
  • Your Snowflake password or certificate for key pair authentication
  • A Snowflake role with appropriate database access (e.g., ACCOUNTADMIN)
  • A Snowflake warehouse name (e.g., COMPUTE_WH)

For more detailed information about connecting Snowflake, see the Snowflake Data Source guide.

Connect to Snowflake Data Source

  1. Navigate to Data Sources from the main menu → Click Add Data Source
  2. Select your data source type from the Source dropdown
  3. Enter a Connection Name (e.g., Sales Database)
  4. Configure the connection details
  5. Click Test Connection to validate
  6. Once successful, click Add Data Source to save

Connection Verified

Once you've successfully tested and added your data source, you're ready to create an IQ Space!


Step 3: Create an IQ Space

Create an IQ Space to define the context for your natural language queries. IQ Spaces unify your data, business semantics, and metadata into a single AI-ready context.

Prerequisites

  • Database and schema with data available (created in Step 1)
  • Data Source configured (completed in Step 2)

Create Your IQ Space

Now that your data source is connected, create an IQ Space to enable natural language queries:

1. Navigate to IQ Spaces

  1. Log in to Trust3 Cloud portal
  2. Navigate to IQ Spaces from the main menu
  3. Click "Create IQ Space" button

2. Define Basic Information

  • Name (Required): Enter name as Snowflake IQ Tutorial

3. Add Data Assets

  1. Click "Add Data Assets" and configure:
  2. Choose your Snowflake data source from the Data Source dropdown (the one you created in Step 2)
  3. Select the Database: TRUST3_SNOWFLAKE_TUTORIAL (the database you created in Step 1)
  4. Click "Add Schemas" button
  5. Select the TPCH_SF1 schema from your database
  6. Click "Add Schemas" to confirm your selection
  7. Select "Yes, generate for all" - This will auto-generate semantic models for all tables in the TPCH_SF1 schema

Semantic Model Generation

By selecting "Yes, generate for all", Trust3 will automatically analyze your tables and generate semantic models, making them ready for natural language queries.

4. Create and Verify

  1. Review your configuration summary
  2. Click "Create IQ Space" button to start the setup process
  3. Wait for setup to complete (this can take up to 10 minutes)
  4. Verify the status shows "Active" in your IQ Spaces list

Setup Complete

Once your IQ Space shows "Active" status, you're ready to start asking questions in the next step!


Step 4: Start asking questions with AskIQ

Now that your IQ Space is active, you can start asking natural language questions about your data.

Start Asking Questions

Now that your IQ Space is active, you can query your data using natural language:

1. Access Ask IQ

  1. Log in to Trust3 Cloud portal
  2. Navigate to Ask IQ from the main menu
  3. Select your IQ Space from the dropdown (the one you just created)

2. Ask Your First Question

Enter your question in the chat interface using natural language. If you're using the TPC-H sample data from Step 1, try questions like:

  • "How many customers are in the database?"
  • "What is the total revenue from all orders?"
  • "Show me the top 10 customers by order value"
  • "How many orders were placed in each region?"
  • "What are the most popular products?"

3. Review the Results

After IQ processes your question, explore the two available tabs:

  • Analysis Tab: View detailed insights, trends, and explanations based on your question
  • Raw Data Tab: View the actual Snowflake SQL query results and the generated SQL query

You're All Set!

You've successfully completed the full journey! Continue exploring your data with natural language queries.


Next Steps