Now, at this point many have tried to get LLMs to write SQL, with middling success when deployed in unknown business environments that come with a lot of convoluted and unknown business logic, messy tables and extremely large and super normalized schemas.
But, that doesn’t mean we can’t leverage Julius’ SQL expertise. It can operate fairly well at different levels of complexity and novelty.
To begin with, you can always ask it to explain something unfamiliar. Let’s assume that I am not familiar with what a QUALIFY
statement does. It’s not that common outside of Snowflake SQL syntax. I could talk to Julius about it which explains it relative to other similar operations, WHERE
and HAVING
, and even explains the order of operations in which they all take place.
This is a great explanation
and a great example
I can make this a bit more advanced and ask it to write queries for me based on some simple questions.
Julius does a correct job, although a bit convoluted. It is very comfortable with writing Common Table Exprressions. I can point that out, use the QUALIFY
statement to simplify it and ask Julius to try the same with DENSE_RANK
so I can see how it does that. Again, very good work, no issues.
I can bring in some wacky Snowflake functions and have Julius encrypt sensitive data (using the passphrase julius
) that someone else would have to input on their end to decrypt it. Julius can play with that too.
Now, let’s get a bit more fancy. Can Julius create a UDF for me to reuse? I really don’t like the fact that the function CURRENT_DATE() returns the timezone local to the query, instead of UTC. And there is not CURRENT_DATE_UTC() in Snowflake. So let’s make one! Julius does it easily.
Now, to get a little bit more complicated. Let’s say I want to count the number of stores by region. Simple, just use a GROUP BY
and a COUNT
. But what if for each group I also want to return 20 random stores in an array, just for a quick check? This type of sample is often useful when giving data at work to someone who isn’t sure of the make-up of each group and would like a quick glance at the contents. Julius does that too. I can even discuss efficiency improvements and improve the query within minutes.
Finally, I recently had to pull some employee data from Twilio and realized that different shifts are not marked at all, just events within them. I can just ask Julius to help me detect when a shift starts and ends using some clever logic. It did not quite get it on the first try, and you can see in the conversation where the mistake I point out is. But, it set up the query architecture and I could just point out the error by inspecting it. Much easier to spot errors in someone else’s work than your own. I particularly like the clever implementation of what would be cummulative sum by group, something Snowflake doesn’t have a native window function for.
It’s important to double check the work as the query logic complexity increases. However, Julius is incredible at speeding up SQL work without even needing to pass it any specific data - simple and clear instructions will do!
Besides Snowflake SQL, Julius can help with other syntaxes as well.
If you have any interesting SQL logic that you got Julius to write for you, I’d love to see it in the replies.