Skip to main content

Often we are faced with time constraints or impending deliveries, it would be handy to have a way to speed up writing, manipulating and navigating Snowflake.
The tool that allows us to bypass tedious time wasters are shortcuts.
This doesn’t sound like a big deal (and maybe it isn’t) however, in my personal experience it is the few shortcuts I master ( the timeless ctrl + c, ctrl + v and ctrl + z ) and a few others.
Snowflake makes so many available to us and if not all of them at least some of them could become part of the baggage of a good user of the platform.

Navigation shortcuts

The first ones I talk about are the navigation ones that allow us to display results and charts conveniently and quickly, also to manage the size of the results window. In the video we can the following shortcuts at work:

ctrl + alt + ↓ Make bottom pane smaller

ctrl + alt + ↑ Make bottom pane large

ctrl + alt + → Go right one pane tab

ctrl + alt + ← Go left one pane tab

Navigation shortcuts

Query Editing

I now assume a more or less realistic, if simplified, situation. I show what happens in the following video and then reveal what’s underneath.

A hypothetical sequence of shortcuts

Find and replace

I have my starting query. But looking at it closely there is something wrong:
the name of the table where I want to do my search is wrong, no big deal! I can use the shortcut :

ctrl + shift + H

It’s for searching and replacing the wrong word, other than for a typo it might be more frequent and more useful to use this shortcut to rename a table within a script within which it is named several times.

Move and copy

Continuing to analyze my worksheet I realize that the GROUP BY operation is in the wrong place, the syntax requires it to be after the conditions specified by WHERE. To move the row of interest I can use the shortcut ( there is also its dual that brings a row up).

alt + ↓

How careless of me! I need some other query that pertains to the table I’m analyzing but I don’t want to waste time with a copy paste.
Nothing could be simpler; I can use the shortcut

alt + shift + ↓

This allows me to copy a row up (using+ ↑) or down.

Comment and delete

But I’ve probably gone too far with the copying. Then I can proceed in commenting out too many lines with the keyboard command:

ctrl + shift +/


The comment toggle is very useful in debugging, for analyzing parts of code and especially for excluding others. Very useful for looking for problems confined to a few lines of code (we can comment them out and try execution without them).
Also in WHERE statements with many successive conditions introduced by the AND keyword we can comment out one logical condition at a time and see what happens.

I can also delete a row, or several rows with:

ctrl + shift + k

Example of comment toggle

Running

There, now I am satisfied with what I have written and can execute the queries, I could execute one at a time with

ctrl + enter

but this time I am not interested in seeing the results in the window, I just want everything to run, to do that I use this key combination:

ctrl + shift + enter

In the video we see the execution of the commands I just talked about in the order in which I mentioned them.

Overview

Finally, downstream of these examples I will let you in on a secret, the most powerful of shortcuts: the one that shows us all the others.

Well, by pressing :

ctrl + shift + ?

we can get an overview of all the shortcuts that Snowflake makes available to us, and in addition to the ones I have described there are others.

Shortcuts overview

So, stretch your fingers and start typing: fast and without wasting time!

 

Auteur