Streamline SQL Workflow with Snowflake Copilot

Snowflake Copilot (2024) is a new tool designed to transform data analysis by converting natural language into SQL queries. We look at its key features, security aspects, and best practices to help fully harness its capabilities. Whether you're new to Snowflake or an experienced user, Copilot is here to simplify your data workflows.
Snowflake Copilot

Why this blog?

Navigating data can be complex, especially when translating business questions into precise SQL queries. Here we have a comprehensive guide to Snowflake Copilot, detailing how it simplifies data analysis by automating SQL generation and enhancing security. You have the opportunity to learn how to optimize your data processes and achieve faster, more accurate insights with this innovative tool.

Can you imagine having a tool that effortlessly bridges the gap between you and your data, allowing you to focus on insights rather than the complexities of coding. Released in April 2024, Snowflake Copilot is precisely that – an assistant designed to make working with data in Snowflake simpler and more intuitive.

With Snowflake Copilot, you can ask questions in plain English, like “What were the total sales last month?” and instantly receive the correct SQL query. This tool seamlessly integrates with Snowflake’s SQL Worksheets and Notebooks, ensuring that your data access permissions are always respected, so you only interact with the data you’re authorized to see.

Let’s dive into the features, limitations, and best practices of Snowflake Copilot to help you harness the full potential of this innovative tool.

What is Snowflake Copilot?

Snowflake Copilot is a sophisticated LLM-powered assistant designed to streamline your data analysis process within Snowflake. Its main function is to make data exploration and insight extraction easier by translating natural language into SQL queries. Unlike typical AI tools, Snowflake Copilot is built on Snowflake Cortex, an intelligent, fully managed AI service that operates securely within the Snowflake environment. This advanced tool understands the nuances of data analysis and SQL queries, making it a valuable resource for navigating your data.

Security First

One of Snowflake Copilot’s standout features is its robust security. Your data remains securely stored within Snowflake, and Copilot adheres strictly to your RBAC settings, ensuring it only accesses data you’re permitted to see. Currently, Snowflake Copilot is available in specific AWS regions:

  • AWS us-east-1
  • AWS us-west-2
  • AWS eu-central-1

If your Snowflake account is in one of these regions, you’re all set to start using Copilot. If not, don’t worry – Snowflake plans to expand its availability soon.

Key Features of Snowflake Copilot

Now that we’ve covered what Snowflake Copilot is, it’s time to dive into what it can actually do. Let’s break it down and explore each of its key features.

1. Data Exploration
Discovering what’s inside a new dataset can be daunting. Snowflake Copilot simplifies this by allowing you to ask open-ended questions about your data. 

For example, you can inquire about the types of information in your dataset or how the main tables are related. Copilot analyzes the schema and provides a concise summary to help you get started.

2. SQL Query Generation
Writing complex SQL queries can be challenging. Snowflake Copilot shines in this area by generating SQL queries based on plain English descriptions. 

For instance, you can request a query to retrieve details of students older than 20, and Copilot will generate the corresponding SQL query for you. It can handle complex requests involving window functions, subqueries, and joins with ease.

3. SQL Query Execution
Once Snowflake Copilot generates a query, you have the option to execute it immediately or add it to your Snowflake Worksheet. This flexibility allows you to run the query right away or modify it as needed for further analysis.

4. Complex Query Building and Refinement
Iterative query building is where Snowflake Copilot truly excels. You can refine your queries step-by-step, improving and adjusting them based on the results. This conversational approach to query development is ideal for complex analyses that require multiple iterations.

5. Snowflake Learning Resource
Snowflake Copilot also serves as an educational tool. If you’re new to Snowflake or need clarification on specific features or best practices, you can ask Copilot for explanations. It provides clear and concise answers, making it a valuable resource for learning.

6. Query Performance Optimization
Creating efficient queries is crucial for performance. Snowflake Copilot can analyze the efficiency of your queries and suggest optimizations, such as rewriting joins or adding indexes, to enhance performance.

7. Custom Instructions
You can customize Snowflake Copilot’s behavior by setting specific instructions. For example, you can instruct Copilot to always add comments to generated queries or use common table expressions (CTEs) instead of subqueries. These customizations help tailor Copilot to your preferences and standards.

8. Feedback Integration
You can provide feedback on responses and suggest enhancements, helping the development team make Copilot even better.

How to Get Started with Snowflake Copilot

Snowflake Copilot is designed to be user-friendly, requiring no extra setup. Here’s how you can get started, even if you’re new to Snowflake:

Key Points to Remember:

  • Each chat with Snowflake Copilot is linked to a specific worksheet or notebook. Opening a new one starts a new chat session.
  • You need to have a database and schema selected during your session. Copilot uses these to generate relevant responses.
  • Copilot utilizes the names and data types of your databases, schemas, tables, and columns to determine available data for queries.
  • If Copilot can’t answer based on the selected database and schema, it may refer to Snowflake documentation or general SQL knowledge. If you encounter unexpected answers, provide feedback using the thumbs up or thumbs down buttons.
  • When mentioning table or column names, prefix them with @ to help Copilot give more accurate responses.
  • For the best performance, use descriptive names for databases, schemas, tables, and columns, and ensure correct data types for columns.

Steps to Start Using Snowflake Copilot:

  1. Start by creating a new worksheet or opening an existing one.
  2. Click on “Ask Copilot” in the lower-right corner of the worksheet to open the Snowflake Copilot panel on the right side.
  3. Ensure that a database and schema are selected for the current worksheet. You can choose these using the selectors at the top of the worksheet or below the Copilot message box.
  4. Type your question into the message box and either click the send icon or press Enter. Copilot will provide a response in the panel.
  5. Handle SQL Statements:
    • If Copilot provides SQL statements, click “Run” to execute the query and add it to your worksheet.
    • Click “Add” to insert the query into your worksheet, where you can edit it before running.

By following these steps, you’ll be able to effectively use Snowflake Copilot to assist with your data queries and analysis.

Examining the constraints of Snowflake Copilot
  1. Language Capabilities
    • Natural Language: Currently supports only English.
    • Query Language: Limited to SQL.
  2. Data Access and Query Restrictions
    • No Direct Table Data Access: Copilot can’t access actual data values, only structures.
    • Unsupported Cross-Database/Schema Queries: Copilot can’t generate queries across multiple databases or schemas.
  3. Performance Considerations
    • Response Delays: Complex requests might experience delays.
    • SQL Suggestion Inaccuracies: Suggested queries might need verification.
  4. Scope Limitations
    • Table and Column Consideration: Copilot focuses on the top 10 tables and columns, which may exclude less obvious connections.
    • Delay in Recognizing New Objects: New databases, schemas, and tables may not be immediately recognized.
  5. Custom Instructions Restrictions
    • Character Limit: Custom instructions are limited to 2000 characters.
    • Plain English Requirement: Instructions must be in plain English.
Recommendations for Optimal Use

To maximize Snowflake Copilot’s benefits, follow these best practices:

1. Design Curated Views
Simplify complex schemas by creating views that join multiple tables. Predefine common metrics and overcome cross-schema limitations by integrating data into these views.

2. Adopt Descriptive Naming
Opt for clear, descriptive names for databases, schemas, tables, and columns. Consistent naming conventions and avoiding abbreviations will improve Copilot’s understanding and response accuracy.

3. Ensure Proper Data Types
Assign correct data types to columns (e.g., DATE for dates, BOOLEAN for binary values) to improve data integrity and query performance.

4. Be Precise and Contextual in Your Queries
Begin with general questions and then narrow them down. Use the ‘@’ prefix to refer to specific tables or columns and include relevant context to improve the accuracy of the responses.

Maximizing the Power of Snowflake Copilot

Snowflake Copilot is changing our approach to data analysis, making it more accessible and intuitive by converting natural language into SQL queries. This powerful tool simplifies data exploration and management, enabling users to navigate their data with ease. By fully understanding its capabilities, limitations, and best practices, you can unlock the full potential of Snowflake Copilot to enhance your data analysis processes and generate deeper business insights. Whether you’re just starting with Snowflake or are a seasoned expert, Copilot offers a streamlined workflow that optimizes your data analysis tasks, making it an invaluable asset in your toolkit.

Featured content

Smarter Healthcare Analytics with Snowflake and Ic...

Serverless Computing in Snowflake...

A Complete Guide on Security and Compliance in Sno...

Enhancing Data Processing with Aggregate Functions...

GCP vs. AWS vs. Azure (2024)...

Choosing the Right Cloud Data Engineering & Analytics Platform: Databricks vs. Snowflake

Databricks vs. Snowflake (2024)...

Snowflake tutorial

Quick Tutorial on DataFrame Updates in Snowpark...

Case study : Unified Workforce Data automation using snowflake

Unified Workforce Data and Automated Insights with...

Loading Data into Snowflake using Snowpark DataFrames

Loading Data into Snowflake using Snowpark DataFra...

snowflake, create data frame

Creating DataFrames in Snowflake Snowpark...

Scroll to Top