How Snowflake Tools Turn Business Analysts Into AI Developers
In this article
Snowflake's new AI tools, specifically Snowflake Cortex and Document AI, allow business analysts to build and deploy machine learning models and LLM-powered applications without writing complex code. This shift works by providing a fully managed environment where analysts use SQL or low-code interfaces to call pre-trained models, process unstructured data, and create AI-driven workflows directly within the data warehouse. The result is that analysts can move from simply reporting on historical data to building predictive tools that automate decisions, all without relying on traditional software engineering teams for every step.
What You'll Need
- A Snowflake account with access to Snowflake Cortex and Document AI (features may vary by edition and region).
- Familiarity with SQL and Snowflake worksheets.
- The ACCOUNTADMIN role or a custom role with necessary privileges (CREATE INTEGRATION, usage on the CORTEX_LLM_FUNCTIONS database).
- Sample data or a specific business problem to solve (e.g., analyzing customer feedback or predicting churn).
Step-by-Step
- Set Up Roles and Privileges. Before accessing AI features, ensure your user role has the correct permissions. In a Snowflake worksheet, execute a command to grant usage on the Cortex LLM functions to your role. For example:
GRANT USAGE ON DATABASE SNOWFLAKE.CORTEX_LLM_FUNCTIONS TO ROLE <your_role>;. This allows you to call the large language models available in Snowflake. - Prepare Your Data. AI development in Snowflake starts with data already in your warehouse. Load your dataset into a table. For unstructured data like PDFs or text documents, create a stage (internal or external) to store these files. Ensure your data is clean and organized, as the quality of AI output depends on the input data.
- Use Document AI for Unstructured Data. If your business problem involves extracting information from documents (like invoices or contracts), use Document AI. Navigate to the AI & ML section in Snowflake's interface and select Document AI. Create a new model by uploading sample documents and labeling the fields you want to extract. Once the model is trained (a process that may take some time), you can invoke it via SQL to process your entire document library and output structured data into a table.
- Build a Semantic View for Context. To enable natural language processing on your structured data, create a Semantic View. This feature maps your database schema to human-readable concepts. In the worksheet, define a semantic view using SQL, specifying the columns and their meanings. This allows the AI to understand the context of your data, so when an analyst asks a question in plain English, the system knows which tables and columns to query.
- Invoke LLM Functions via SQL. Use Snowflake Cortex to call large language models directly from your SQL queries. For example, to analyze customer sentiment in a feedback column, you can write a query like:
SELECT SNOWFLAKE.CORTEX.SENTIMENT(text_column) FROM feedback_table;. You can also use theCOMPLETEfunction for tasks like summarization or translation by passing a prompt and the data column. - Create a Streamlit Application. To turn your SQL-based AI logic into a usable tool for other business users, build a Streamlit app directly in Snowflake. Navigate to Projects and create a new Streamlit app. Use Python code (which Snowflake manages) to create a user interface that accepts inputs (like a text prompt or file upload) and displays the results of your Cortex or Document AI queries. This step transforms your analysis into a shareable application.
- Deploy and Share. Once your Streamlit app is functional, share it with stakeholders. Snowflake's governance features ensure that the app only accesses data the user is permitted to see. You can also schedule your SQL queries to run automatically, keeping your AI-driven insights up-to-date without manual intervention.
Common Mistakes
One frequent mistake is neglecting data governance. Analysts might attempt to process sensitive data without proper masking policies, which can lead to compliance issues. Always verify that your role has the correct privileges and that sensitive columns are protected before running AI models. Another common error is overestimating the AI's ability to understand business context without guidance. Simply pointing a model at a table often yields poor results; you must use semantic views or clear prompts to define what the data represents. Finally, avoid skipping the testing phase with Document AI. A model trained on only a few documents may not generalize well to different formats, so always validate extraction accuracy on a holdout set of documents before deploying it for production use.
Tips
Start with a small, well-defined use case, such as summarizing customer support tickets, to build confidence before tackling complex predictive modeling. Use the TRY_COMPLETE function in Cortex to handle errors gracefully; this ensures your query continues even if the AI encounters an issue with a specific row. Leverage Snowflake's native streaming capabilities to feed real-time data into your AI models, allowing for dynamic insights rather than static reports. When building Streamlit apps, separate your logic from your presentation code to make future updates easier. Always document your prompts and model choices; as Snowflake updates its available models, you may need to adjust your prompts to maintain consistent results.
Troubleshooting
If you encounter an error stating that the Cortex functions are not available, check your account's region and edition, as some features roll out incrementally. Verify that you have run the grant commands correctly and that your role is active. If Document AI returns poor extraction results, review your training data; you likely need more labeled examples or a clearer definition of the fields you want to extract. For performance issues, such as queries running slowly, consider optimizing your warehouse size; AI tasks often require more compute resources than standard SQL queries. If a Streamlit app fails to load, check the Python code for syntax errors and ensure all referenced tables and stages exist and are accessible by the app's role. If results seem inaccurate, refine your prompts—ambiguous instructions often lead to vague AI outputs.
Frequently Asked Questions
Do I need to know Python to use Snowflake's AI tools?
No, you can perform many tasks, such as sentiment analysis and text summarization, entirely with SQL using Snowflake Cortex. Python is only required if you choose to build custom Streamlit applications.
What is the difference between Snowflake Cortex and Document AI?
Snowflake Cortex provides access to general-purpose large language models for tasks like translation and sentiment analysis. Document AI is specialized for extracting structured data from unstructured documents like PDFs.
Is my data sent to a third-party when using these AI tools?
Snowflake manages the models within its own environment. Your data does not leave Snowflake's security perimeter when processed by these tools, which helps maintain compliance and data privacy.
Can I use my own custom models with Snowflake?
Yes, Snowflake supports bringing your own model (BYOM) through containers, but this requires more technical setup and is distinct from the out-of-the-box tools designed for business analysts.
How do I control costs when running AI queries?
AI queries consume compute credits. To manage costs, use a dedicated virtual warehouse so you can monitor and control usage separately from your daily operations, and start with a smaller warehouse size.