There is a mandate at work to use AI. This makes some sense as people are somewhat resistant to change, and I do work for a company that is all about AI. I’ve incorporated LLMs into my workflow in several ways, and am really enjoying Cortex Code specifically.
AI and Writing
I’ve been using LLMs a bit in writing for a while in very targeted ways. I still find that asking an LLM to write an entire article for me, even if I provide the topic and some important points, does not really work. It still comes up with AI slop – an article that sounds good, probably looks good to management, but doesn’t actually provide all that much value. I’m sure that my content is used by LLMs, as my content is freely available on the internet. I know that my internal content is sourced by multiple different internal LLMs. It used to be I would google a question and get my own blog articles (sometimes things I had forgotten I had written!) as a response. Now I ask an LLM and look to the sources to validate an answer, and it is sometimes my own content.
The place I find LLMs great for writing is in very targeted ways. I’ve used it in brainstorming, when I’m having trouble structuring content, in places where I used to use a thesaurus and in rewording things when I’m having trouble coming up with the right words. I use the prompt “Please help me reword this without using the word you and avoiding the passive voice…” a fair amount.
AI for Snowflake
I’m not a person who does a lot of straight coding. I am a person who spends an inordinate amount of time with SQL and looking at data about specific SQL statements or parameterized query hashes. Instead of returning to my worksheet full of tried and true SQL to run or tweak, I now put that same SQL into Cortex Code and ask it to run it. I have long conversations with Cortex Code where I ask it to suggest better ways to visualize the data I’m working with, and it is so much faster at graphing things in new and interesting ways than I am.
I went to write a blog article about a new topic just now, and I actually missed having Cortex Code available. It has become integral to my workload. I started doing some of this with with Cursor, and it was OK. However, I mostly resenting being required to use Cursor. When I got early access to Cortex Code, it immediately became my go-to tool.
All this tells me – it is time to share how to set up Cortex Code and share a few things I find it particularly useful for. Cortex Code(CLI) is far from the only AI tool available for Snowflake, it’s just the topic of this article.
Cortex Code Free Trial
For this blog, I don’t use any of the resources that I get access to as an employee. I am perpetually signing up for new free trials and debating if I’m willing to pay for something just to write blog articles that do not earn me any money. Here’s the link to sign up for a free trial: https://signup.snowflake.com/cortex-code
One of the unfortunate things about this free trial is that it does require a credit card number, unlike the Snowflake free trial. If you go beyond the trial period, your card will be charged, so be sure to cancel it!
Cortex Code is currently available as a CLI – perfect for someone like me who likes the command line. Once you’ve supplied your credit card, you’ll get a screen that looks something like this:

To set it up on my laptop, I ran this:
curl -LsS https://ai.snowflake.com/static/cc-scripts/install.sh | sh
and answered questions and followed the instructions.
After restarting my terminal, I could run it by typing simply cortex and hitting enter, and then I’m in the cortex cli:

You’ll need to answer some basic questions, and set up your connection(s). Note that it is entirely possible to use a different account for your Cortex Code usage than where you run your SQL queries. If you’re on free trials, the Oauth method is probably easiest. If you’re setting this up for work, then I’d use a PAT – they’re easy to generate and use. Cortex Code can guide you through setting up connection details.
When you’re through this, you’ll see a prompt that looks like this:

Cortex Code understands the context of Snowflake. Note that it’s still a coding LLM and is not perfect at things – it still makes mistakes and needs guidance from the user to get the desired result. Be careful that you’re properly supervising what it is doing with your production data. It can also write less than optimal SQL that may be expensive.
Once you’ve been working with cortex code, you can also resume previous sessions – use cortex resume to do this.
Cortex Code and Performance Suggestions
Since my primary area of expertise is core performance for Snowflake, I have to mention that even Cortex Code is just an LLM. It might have good performance suggestions or bad ones – be sure to validate the suggestions before sinking time and money into them. It may be right 80% of the time, but being able to identify which 80% can be critical when working with your data estate.
I’m publishing an article soon taking a look at performance suggestions from Cortex Code.

