Loading data using the web interface¶

You can use Snowsight or Classic Console to load files with structured data (e.g. CSV, TSV) or semi-structured data (e.g. JSON, Avro, ORC, Parquet, or XML).

Use the web interface to load data from files up to 250 MB in size. To load larger files, or large numbers of files, use the Snowflake client, SnowSQL. Refer to Bulk loading from a local file system.

Loading data using Snowsight¶

You can use Snowsight to load files for the following scenarios:

  • Loading a file or multiple files from your local machine into an existing table.

  • Loading a file from a stage into an existing table.

  • Creating a new table when loading a local or staged file. Snowsight uses the INFER_SCHEMA table function to automatically detect the file metadata schema, retrieve the column definitions, and generate a new table. This feature doesn’t support XML files.

You can load data from individual files up to 250 MB in size.

Note

To use Snowsight to load data, you must use a role that has the OWNERSHIP privilege on the table that you want to load data into and the USAGE privilege on the database and schema that contain the table. See Table privileges.

If you want to use a named file format, your role must also have the USAGE privilege on that specific file format.

Load files from your local machine into an existing table¶

  1. Sign in to Snowsight.

  2. In the navigation menu, select Data » Databases.

  3. Select a specific database and schema.

  4. In the object explorer, select the table that you want to load data into.

  5. Select Load Data.

  6. In the Load Data into Table dialog, select Browse.

  7. Add structured or semi-structured data files.

  8. If you do not have a default warehouse set for your user, select a warehouse.

  9. Select Next.

  10. Do one of the following:

    • Select a file format from the current database.

    • Select a file type to customize, and then select the relevant settings for your data file.

  11. (Optional) Select what should happen if an error occurs during loading. By default, no data is loaded from the file.

  12. Select Load.

    Snowsight loads your file and displays the number of rows successfully inserted into the table.

  13. Do one of the following:

    • To open a worksheet with SQL syntax for querying your table, select Query Data.

    • To close the dialog, select Done.

    If your file cannot be loaded, for example, if the columns in the file do not match the columns specified in the table, an error message is displayed. To adjust your settings, select Back.

Load a file from a stage into an existing table¶

Before loading files from a stage into a table, you need to create a stage and upload files onto the stage. For instructions, see Staging files using Snowsight.

  1. Sign in to Snowsight.

  2. In the object explorer, select the stage that you want to load files from.

  3. In the list of the files on the stage, select the file that you want to load into the table.

  4. In the ellipsis dropdown menu of the selected file, select Load into table.

  5. In the Load Data into Table dialog, select a database, schema, and a table where you want to load the file.

  6. Select Next.

  7. Do one of the following:

    • Select a file format from the current database.

    • Select a file type to customize, and then select the relevant settings for your data file.

  8. (Optional) Select what should happen if an error occurs during loading. By default, no data is loaded from the file.

  9. Select Load.

    Snowsight loads your file from the stage to the table.

Alternatively, you can load a staged file into a table by copying the path of the staged file.

  1. Follow steps 1-3 in the previous procedure.

  2. In the ellipsis dropdown menu of the selected file on the stage, select Copy path.

  3. In the object explorer, select the table that you want to load data into.

  4. Select Load Data.

  5. In the Load Data into Table dialog that appears, select Add from Stage.

  6. Paste the path that you copied into the path field, and then select Add.

    The staged file name appears.

  7. Select Next.

  8. Do one of the following:

    • Select a file format from the current database.

    • Select a file type to customize, and then select the relevant settings for your data file.

  9. (Optional) Select what should happen if an error occurs during loading. By default, no data is loaded from the file.

  10. Select Load.

    Snowsight loads your file and displays the number of rows successfully inserted into the table.

Create a table when loading a file¶

You can create a new table when loading a file by taking the following steps. Alternatively, you can open the Load Data into Table dialog from a stage by following the steps 1-4 in the previous section Load a file from a stage into an existing table and then take the following steps 6-10 to complete the same tasks.

Note

This feature supports delimited files, JSON, Parquet, Avro, and ORC files. It doesn’t support XML files.

To perform the tasks below, you must have the privileges for creating table.

  1. Sign in to Snowsight.

  2. In the navigation menu, select Data » Databases.

  3. Select a specific database and schema.

  4. Select Create.

  5. In the drop-down menu, select Table » From File.

  6. In the Load Data into Table dialog, select Browse to add a file, or Drag and drop a file to the dialog, or Add a file from stage. Optionally, choose the location of your file.

  7. Select a database and a schema where you want the table to be created.

  8. Enter a name for the new table and then select Next.

    Snowsight detects the metadata schema for the file and returns the file format and column definitions identified by the INFER_SCHEMA function.

  9. Review the inferred file format, data type, column name, and a sample of column data. Ensure all information is accurate and make updates if needed.

  10. Select Load.

    Snowsight loads the file and creates a new table for the file.

Loading data using Classic Console¶

The Classic Console provides a wizard for loading limited amounts of data into a table from a small set of files. The wizard performs the same PUT and COPY operations that you would using SQL, but combines the two phases (staging files and loading data) into a single operation and deleting all staged files after the load completes.

You can load data from files on your local machine or files already staged in an existing cloud storage location on Snowflake, Amazon S3, Google Cloud Storage, or Microsoft Azure.

Prerequisites for loading data¶

Before you start loading data using Classic Console, do the following:

  • Identify the location your data files. You can load data from one of the following:

    • Your local machine.

    • An internal or external stage.

    • A cloud storage location on Amazon S3, Google Cloud Storage, or Microsoft Azure that is not yet added to Snowflake as an external stage.

  • Determine the size of your data files. Each file that you load can be up to 250 MB. If you want to load larger files, or large numbers of files, use the Snowflake client, SnowSQL, instead. Refer to Bulk loading from a local file system.

The role that you use to load data must have appropriate privileges:

  • To load data, your role must have the USAGE privilege on the database and the schema that contain the table that you load data into.

  • To create a stage when you load data, your role must have the CREATE STAGE privilege on the database schema.

  • To create a file format when you load data, your role must have the CREATE FILE FORMAT privilege on the database schema.

Start loading data¶

To start loading a file into a specific table, do the following:

  1. Select Databases Databases tab.

  2. Select a specific database and schema.

  3. Select the Tables tab.

  4. Locate the table into which you want to load data.

  5. Start loading data into a specific table by doing one of the following:

    • Select a table row, then select Load Data.

    • Select a table name to open the table details page, then select Load Table.

    The Load Data wizard opens.

  6. Select a warehouse to use to load data into the table. The drop-down includes any warehouse on which you have the USAGE privilege.

  7. Select Next.

Select the data to load¶

Depending on where you choose to load data from, follow the relevant steps. If you want to load data from multiple locations, use the Load Data wizard multiple times.

To load data from your computer:

  1. Select the Load files from your computer option, and select Select Files to browse to the files that you want to load.

  2. Select one or more local data files and select Open.

  3. Select Next.

To load data from an existing stage:

  1. Select the Load files from external stage option.

  2. Select an existing stage from the Stage dropdown list.

  3. (Optional) Specify a path to the files in the stage.

  4. Select Next.

To create a stage, for example to load data from external cloud storage:

  1. Select the Load files from external stage option.

  2. Select the + next to the Stage dropdown list.

  3. Select the supported cloud storage service where your files are located.

  4. Select Next.

  5. Complete the fields to describe your stage. For more information, refer to CREATE STAGE.

  6. Select Finish.

    Your new stage is automatically selected from the Stage dropdown list.

  7. (Optional) Specify a path to the files in the stage.

  8. Select Next.

Finish loading data¶

After you select the files to load, finish loading data into your table.

Note

If your warehouse is not running when you finish loading data, you must wait for the warehouse to resume (up to 5 minutes) before data is loaded.

To finish loading data, do the following:

  1. Select an existing named file format from the dropdown list, or create one.

    To create a file format:

    1. Select the + next to the dropdown list.

    2. Fill in the fields to match the format of your data files. For descriptions of the options, refer to CREATE FILE FORMAT.

    3. Select Finish.

    Your new named file format is automatically selected from the dropdown list.

  2. Determine how you want to handle errors that occur when the data is loaded:

    • If you want data loading to stop if an error occurs, select Load.

    • If you want errors to be handled in a different way:

      1. Select Next.

      2. Select the option that describes how you want to handle errors. For details about the options, refer to the ON_ERROR section of COPY INTO <table>.

      3. Select Load.

    Snowflake loads the data into your selected table using the warehouse you selected.

  3. Select OK to close the Load Data wizard.