Loading data using Snowflake's web interface
1. Loading data using Snowflake's web interface
Another powerful way of ingesting data into Snowflake is by using one of the various options within Snowflake's web interface. In this video, we'll specifically cover how to ingest data from a local file directly into a table in Snowflake. But don't worry, you'll get a glimpse of all of the available options within your account shortly. Using the web interface is ideal when you have data that is ready to load and you need a quick and straightforward way of loading it into Snowflake. This might be something you do for an initial data migration, periodic data updates, or maybe one-off uploads. What's great is that Snowflake supports a variety of different file formats, and the UI is a fast way of getting data into Snowflake without having to worry too much about the format of the file. For example, Snowflake easily handles CSV, JSON, Parquet, XML, and many other file formats. But Snowflake can go even further. If you're loading data that's been compressed, Snowflake can also handle those compression algorithms and decompress the files for you during data loading. You can check out all the supported compression algorithms in Snowflake's technical documentation. For now, let's get hands-on and use the web interface to load some data into Snowflake. We'll actually load this same data set into your account multiple times throughout this module, but using different methods of course. The nature of the data isn't the important thing to focus on. For now, it's more important to focus on the method of ingestion. Toward the end of this module, we'll load some different data sets into your account, and we'll use that data throughout the rest of the course. Okay, with that, let's walk through the process together. Pause the video now if you need to log into your Snowflake account. Start by clicking on Data, then clicking on Add Data. You'll be presented with a page outlining several different options for ingesting data into Snowflake. The first option you should see is Load Data into a Table. Click on it. A modal should appear, prompting you to upload files. Before we upload anything, let's take a closer look at the modal. Just by inspecting the modal a little more, you can see that you can upload files from your local computer or from a stage. In this video, we'll cover the former. We'll touch on stages later in this module. You'll also notice that you'll need to select the database and schema that corresponds to the table you want to load data into. We'll use this modal to create and select those objects shortly. Finally, you'll note there's an option to select or create a table, meaning you can load data into an existing table or create a new table upon loading the data. We'll create a new table and also name the table using the input form below. Okay, let's load some data into our accounts using this option. For the purposes of convenience, the file containing the data that we'll upload is in our GitHub repository. If you've already cloned the repo to your computer, you'll simply need to navigate to the correct directory to select the file. Otherwise, you can navigate to the repository on GitHub, find the file there, and download it. If you're doing this now, make sure you take note of where this is being downloaded on your computer. I already have the file on my local file system, so I'll start by clicking on Browse. The file is in the Module 2 folder within the repo and is called Sample Orders CSV. Select the file and click Open. You'll see the file within the modal along with the approximate file size next to the file name. Let's now create a database to store this data. Click on the Add Database button. Name the database Load Data. Feel free to enter a comment if you'd like. I'll leave mine blank. Click Create. Okay, great. The database is created and you can see the schema public has been selected. For the purposes of this exercise, this schema works just fine, so I'll leave it alone. Below that, the Create New Table option should already be highlighted for me, so I'll leave it as is. I'll enter a name for the table and I'll name it Sample Orders UI. Click Next. Snowflake automatically inferred several things for us about this data without us needing to do anything. That's amazing. First, it inferred the file format. You'll see on the left that Snowflake detected this as a CSV file along with some other options, which you can view by expanding View Options. Snowflake also automatically inferred the table schema of our data. A table schema is a definition that describes the organization of data within a table, specifically defining things like columns, their data types, and more. You can see all of that surfaced here. Data types, column names, and even a tiny preview of the data. My favorite part about the automatic schema detection here is that I have the ability to override anything that Snowflake inferred. For example, maybe I want to handle a certain column as a different data type, or rename columns, or something else. There's also an option here that allows me to specify what should happen if an error is encountered during the loading of the data. If you expand it, you'll see the options in full. I'll leave it to the default, which is to abort the loading of the file. Up here, you can see that I can select the virtual warehouse I want to use to power the ingestion. We'll touch on virtual warehouses later in the module. For now, we can leave this set to the current virtual warehouse. I love how easy it is to customize the loading of the data in this part of the model. And finally, before we load the data, one more quick thing. For all the SQL fans that want to see what is happening under the hood, you can preview the SQL that will be executed according to what was specified in the model by clicking on Show SQL. You can see the SQL used to create the table, to define the file format, and more. We'll touch on quite a few of these things in an upcoming video. Okay, hide the SQL by clicking Hide SQL, and now load the data by clicking Unload. If successfully loaded, you'll see a model like this presenting an option to query the data immediately if you want to. If you click on that, a new SQL worksheet will open for you with a sample query pre-written for you. Okay, that's it. That's how to ingest local file data directly into tables in Snowflake using the web interface. Well done! Now, a quick note here before we move on. This process didn't require us to write any code, but don't let the simplicity and ease of use of this workflow fool you. It's an incredibly powerful way of ingesting data into Snowflake at scale. The great thing about using the UI is that many things are abstracted away for you to make it easy for you to use the power of Snowflake to ingest data. But you still have the full flexibility to configure things like error handling, compute power, the table schema, and much more throughout the entire process. In fact, coming up, we'll dig a little deeper and understand how to optimize data ingestion into Snowflake.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.