Data transformations in Visual Studio Code (Optional)
1. Data transformations in Visual Studio Code (Optional)
Just a quick heads up, this is an optional video. Feel free to skip this video if you don't use Visual Studio Code. If you do use VS Code as your preferred development environment, or if you have other tools or extensions that you frequently use as part of this development environment, then the Snowflake extension for Visual Studio Code might be a good fit for you. With the extension, you can execute SQL and Python against your Snowflake environment directly from VS Code, and it's pretty easy to do. Follow along with me and I'll show you how to use it. In an earlier video, we installed the Snowflake extension for VS Code, so we can dive right in. If you have not yet installed the extension and you're interested in following along, you can pause the video and install it by following the instructions in the corresponding video in the first module. Click on the Snowflake icon in your VS Code toolbar. This will open up a sidebar with fields to log into your account. There are a few different ways to log in. You're familiar with the Snowflake CLI, so you could use the option here to use your credentials within your config file to log in, but I'm going to log in using the account URL. Navigate to Snowsight. Hover over your account information at the bottom. If you hover over your account details, you'll encounter this button that allows you to copy your account URL to the clipboard. Click on that. Navigate back to VS Code, and the account identifier slash URL form paste in what you just copied. The extension will parse it and prompt you to log in with your credentials. Type your credentials and log in. Great, now you're logged in. We won't be doing anything brand new for our pipeline here. The point of this exercise is to get you familiar with this environment. We'll perform the same transformations we performed when creating the wind speed Hamburg view. Within the extension, we get a roughly similar layout to Snowsight with object explorer and query history panes. Open the Hamburg sales VS Code SQL file. It contains a code to create the wind speed Hamburg view. At the top of the file, you'll see a play button like what you see in Snowsight. Clicking on this will execute the entire file. You should see this button for any SQL file you open. Clicking it will execute the file against your Snowflake environment. If you want to execute just a block of SQL, you could click on the execute word right above the block that you want to run. Execute the first three lines of code that set your context. You'll note the pane at the bottom shows the results. Now, execute the first block of SQL. Just like Snowsight, you'll see the results at the bottom. Play around and execute the other blocks of SQL if you'd like. I'll execute the entire file now. I've appended underscore VS underscore code to the end of the view names just so that we can distinguish them in Snowsight. I'll execute the entire file now. Great. It was successful as expected. You can see the query history pane update, and you can browse the object explorer to find the view. I'll click on it, and you'll see the definition below. Now, let's navigate back to Snowsight to confirm creation of the view. Yep. There it is. Okay, great. You've learned how to log into your Snowflake account using a Snowflake extension for VS Code. You've also learned how to execute SQL code directly from the code editor. Why is this important? Again, if VS Code is your preferred development environment, this is a great tool to leverage. It's also great in case you're using other tools and extensions with VS Code that aid in the building of data pipelines. I encourage you to explore the extension in more detail and see what kinds of cool things you can discover within.2. Let's practice!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.