Loading Data | Snowflake Documentation (2023)

This topic provides best practices, general guidelines, and important considerations for loading staged data.

Options for Selecting Staged Data Files

The COPY command supports several options for loading data files from a stage:

  • By path (internal stages) / prefix (Amazon S3 bucket). See Organizing Data by Path for information.

  • Specifying a list of specific files to load.

  • Using pattern matching to identify specific files by pattern.

These options enable you to copy a fraction of the staged data into Snowflake with a single command. This allows you to execute concurrent COPY statements that match a subset of files, taking advantage of parallel operations.

Lists of Files

The COPY INTO <table> command includes a FILES parameter to load files by specific name.


Of the three options for identifying/specifying data files to load from a stage, providing a discrete list of files isgenerally the fastest; however, the FILES parameter supports a maximum of 1,000 files, meaning a COPY command executed with the FILESparameter can only load up to 1,000 files.

For example:

COPY INTO load1 FROM @%load1/data1/ FILES=('test1.csv', 'test2.csv', 'test3.csv')
(Video) What is Data Pipeline | How to design Data Pipeline ? - ETL vs Data pipeline (2023)

File lists can be combined with paths for further control over data loading.

Pattern Matching

The COPY INTO <table> command includes a PATTERN parameter to load files using a regular expression.

For example:

COPY INTO people_data FROM @%people_data/data1/ PATTERN='.*person_data[^0-9{1,3}$$].csv';

Pattern matching using a regular expression is generally the slowest of the three options for identifying/specifyingdata files to load from a stage; however, this option works well if you exported your files innamed order from your external application and want to batch load the files in the same order.

Pattern matching can be combined with paths for further control over data loading.


The regular expression is applied differently to bulk data loads versus Snowpipe data loads.

  • Snowpipe trims any path segments in the stage definition from the storage location and applies the regular expression to any remainingpath segments and filenames. To view the stage definition, execute the DESCRIBE STAGE command for the stage.The URL property consists of the bucket or container name and zero or more path segments. For example, if the FROM location in a COPYINTO <table> statement is @s/path1/path2/ and the URL value for stage @s is s3://mybucket/path1/, then Snowpipe trims/path1/ from the storage location in the FROM clause and applies the regular expression to path2/ plus the filenames in thepath.

  • Bulk data load operations apply the regular expression to the entire storage location in the FROM clause.

Snowflake recommends that you enable cloud event filtering for Snowpipe to reduce costs, event noise, and latency. Only use the PATTERN option when your cloud provider’s event filtering feature is not sufficient. For more information about configuring event filtering for each cloud provider, see the following pages:

Executing Parallel COPY Statements That Reference the Same Data Files

When a COPY statement is executed, Snowflake sets a load status in the table metadata for the data files referenced in the statement. This prevents parallel COPY statements from loading the same files into the table, avoiding data duplication.

When processing of the COPY statement is completed, Snowflake adjusts the load status for the data files as appropriate. If one or more data files fail to load, Snowflake sets the load status for those files as load failed. These files are available for a subsequent COPY statement to load.

Loading Older Files

This section describes how the COPY INTO <table> command prevents data duplication differently based on whether the load status for a file is known or unknown. If you partition your data in stages using logical, granular paths by date (as recommended in Organizing Data by Path) and load data within a short period of time after staging it, this section largely does not apply to you. However, if the COPY command skips older files (i.e. historical data files) in a data load, this section describes how to bypass the default behavior.

Load Metadata

Snowflake maintains detailed metadata for each table into which data is loaded, including:

  • Name of each file from which data was loaded

  • File size

  • ETag for the file

  • Number of rows parsed in the file

  • Timestamp of the last load for the file

  • Information about any errors encountered in the file during loading

This load metadata expires after 64 days. If the LAST_MODIFIED date for a staged data file is less than or equal to 64 days, the COPY command can determine its load status for a given table and prevent reloading (and data duplication). The LAST_MODIFIED date is the timestamp when the file was initially staged or when it was last modified, whichever is later.

(Video) Process Excel files in Azure with Data Factory and Databricks | Tutorial

If the LAST_MODIFIED date is older than 64 days, the load status is still known if either of the following events occurred less than or equal to 64 days prior to the current date:

  • The file was loaded successfully.

  • The initial set of data for the table (i.e. the first batch after the table was created) was loaded.

However, the COPY command cannot definitively determine whether a file has been loaded already if the LAST_MODIFIED date is older than 64 days and the initial set of data was loaded into the table more than 64 days earlier (and if the file was loaded into the table, that also occurred more than 64 days earlier). In this case, to prevent accidental reload, the command skips the file by default.


To load files whose metadata has expired, set the LOAD_UNCERTAIN_FILES copy option to true. The copy option references load metadata, if available, to avoid data duplication, but also attempts to load files with expired load metadata.

Alternatively, set the FORCE option to load all files, ignoring load metadata if it exists. Note that this option reloads files, potentially duplicating data in a table.


Loading Data | Snowflake Documentation (1)

In this example:

  • A table is created on January 1, and the initial table load occurs on the same day.

  • 64 days pass. On March 7, the load metadata expires.

  • A file is staged and loaded into the table on July 27 and 28, respectively. Because the file was staged one day prior to being loaded, the LAST_MODIFIED date was within 64 days. The load status was known. There are no data or formatting issues with the file, and the COPY command loads it successfully.

  • 64 days pass. On September 28, the LAST_MODIFIED date for the staged file exceeds 64 days. On September 29, the load metadata for the successful file load expires.

  • An attempt is made to reload the file into the same table on November 1. Because the COPY command cannot determine whether the file has been loaded already, the file is skipped. The LOAD_UNCERTAIN_FILES copy option (or the FORCE copy option) is required to load the file.

    (Video) Installing 70's Software, How Hard Can It Be?

Loading Data | Snowflake Documentation (2)

In this example:

  • A file is staged on January 1.

  • 64 days pass. On March 7, the LAST_MODIFIED date for the staged file exceeds 64 days.

  • A new table is created on September 29, and the staged file is loaded into the table. Because the initial table load occurred less than 64 days prior, the COPY command can determine that the file had not been loaded already. There are no data or formatting issues with the file, and the COPY command loads it successfully.

JSON Data: Removing “null” Values

In a VARIANT column, NULL values are stored as a string containing the word “null,” not the SQL NULL value. If the “null” values in your JSON documents indicate missing values and have no other special meaning, we recommend setting the file format option STRIP_NULL_VALUES to TRUE for the COPY INTO <table> command when loading the JSON files. Retaining the “null” values often wastes storage and slows query processing.

CSV Data: Trimming Leading Spaces

If your external software exports fields enclosed in quotes but inserts a leading space before the opening quotation character for each field, Snowflake reads the leading space rather than the opening quotation character as the beginning of the field. The quotation characters are interpreted as string data.

Use the TRIM_SPACE file format option to remove undesirable spaces during the data load.

For example, each of the following fields in an example CSV file includes a leading space:

"value1", "value2", "value3"

The following COPY command trims the leading space and removes the quotation marks enclosing each field:

COPY INTO mytableFROM @%mytableFILE_FORMAT = (TYPE = CSV TRIM_SPACE=true FIELD_OPTIONALLY_ENCLOSED_BY = '0x22');SELECT * FROM mytable;+--------+--------+--------+| col1 | col2 | col3 |+--------+--------+--------+| value1 | value2 | value3 |+--------+--------+--------+
(Video) Creating Easy Data Entry Forms in Excel


What is the recommended method for loading data into Snowflake? ›

Bulk Loading Using the COPY Command

This option enables loading batches of data from files already available in cloud storage, or copying (i.e. staging) data files from a local machine to an internal (i.e. Snowflake) cloud storage location before loading the data into tables using the COPY command.

What will happen if you mistakenly attempt to load the same file into a table in Snowflake which had already been successfully loaded the previous day? ›

Because the COPY command cannot determine whether the file has been loaded already, the file is skipped.

When loading data in Snowflake which statements are true? ›

When loading data in Snowflake, which two are true? - You can query a portion of data in external cloud storage without loading into Snowflake. - The Snowflake Data Load wizard has a limitation on file size.
Terms in this set (9)
  • Stage.
  • Pipe.
  • Table.

Which practice will provide the most efficient loading performance? ›

One of the best ways to maximize performance during data loading is to optimize the files' size. Make sure to: Split the data into multiple small files to support optimal data loading in Snowflake. Use a separate data warehouse for large files.

How do you load bulk data in a Snowflake? ›

  1. Create File Format Objects.
  2. Create Stage Objects.
  3. Stage the Data Files.
  4. Copy Data into the Target Tables.
  5. Resolve Data Load Errors.
  6. Remove the Successfully Copied Data Files.
  7. Clean Up.

How do you load data into a Snowflake stage? ›

Loading Your Data

Execute COPY INTO <table> to load your staged data into the target table. Loading data requires a warehouse. If you are using a warehouse that is not configured to auto resume, execute ALTER WAREHOUSE to resume the warehouse. Note that starting the warehouse could take up to five minutes.

Which factors affect your Snowflake data loading rate? ›

Number and types of columns – A larger number of columns may require more time relative to number of bytes in the files. Gzip Compression efficiency – More data read from S3 per uncompressed byte may lead to longer load times.

What is continuous data loading in Snowflake? ›

Snowpipe is Snowflake's continuous data ingestion service. Snowpipe loads data within minutes after files are added to a stage and submitted for ingestion. With Snowpipe's serverless compute model, Snowflake manages load capacity, ensuring optimal compute resources to meet demand.

How to skip data errors during loading in Snowflake during bulk loading? ›

Step 5. Resolve Data Load Errors
  1. Prerequisites.
  2. Create File Format Objects.
  3. Create Stage Objects.
  4. Stage the Data Files.
  5. Copy Data into the Target Tables.
  6. Resolve Data Load Errors.
  7. Remove the Successfully Copied Data Files.
  8. Clean Up.

How can I reduce my loading time? ›

9 Quick Ways to Improve Page Loading Speed
  1. Choose a performance-optimized hosting solution. ...
  2. Compress and optimize your images. ...
  3. Reduce your redirects. ...
  4. Cache your web pages. ...
  5. Enable browser caching. ...
  6. Use asynchronous and defer loading for your CSS and JavaScript files. ...
  7. Minify CSS, JavaScript, and HTML.
Oct 15, 2020

How can I speed up loading time? ›

How to Improve Your Page Load Time
  1. Optimize Image Size and Format. ...
  2. Optimize Dependencies. ...
  3. Avoid Inline JS and CSS files. ...
  4. Optimize Caching. ...
  5. Avoid render blocking scripts. ...
  6. Avoid Redirects. ...
  7. Set up G-Zip Encoding. ...
  8. Reduce HTTP Requests.

What is the default action to perform when an error is encountered while loading data from a file using Snowpipe? ›

The notifications describe the errors encountered in each file, enabling further analysis of the data in the files. Snowpipe error notifications only work when the ON_ERROR copy option is set to SKIP_FILE (the default). Snowpipe will not send any error notifications if the ON_ERROR copy option is set to CONTINUE.

How does Snowflake always load the incremental data files ignoring the ones already loaded? ›

We can achieve incremental loading in snowflake by implementing change data capture (CDC)using Stream and Merge objects.

Which file format is most performant in Snowflake for data loading? ›

Methods of Loading Data to Snowflake

Although many different formats can be used as input in this method, CSV Files are used most commonly. You can also automate the bulk loading of data using Snowpipe. It uses the COPY command and is beneficial when you need to input files from external sources into Snowflake.

How will you bulk load data? ›

Bulk loading is used when you need to import or export large amounts of data relatively quickly. With bulk loading operations, you don't just insert data one row at a time; data is instead inserted through a variety of more efficient methods based on the structure of the specific database.

What is the difference between bulk loading and snowpipe? ›

Bulk data load: The load history is stored in the target table's metadata for 64 days. Snowpipe: The pipe's metadata stores the pipe's history for 14 days. The ACCOUNT USAGE view or SQL table function can be used to request the history from a REST endpoint.

How ETL is done in Snowflake? ›

What is the ETL Process? ETL is an acronym that represents “extract, transform, load.” During this process, data is gathered from one or more databases or other sources. The data is also cleaned, removing or flagging invalid data, and then transformed into a format that's conducive for analysis.

What are the types of data files can be loaded in Snowflake? ›

For loading data from delimited files (CSV, TSV, etc.), UTF-8 is the default. For loading data from all other supported file formats (JSON, Avro, etc.), as well as unloading data, UTF-8 is the only supported character set.

How do I load data from Snowflake to SQL Server? ›

  1. Add the Components. To get started, add a new Snowflake source and SQL Server ADO.NET destination to a new data flow task.
  2. Create a New Connection Manager. ...
  3. Configure the Snowflake Source. ...
  4. Configure the SQL Server Destination. ...
  5. Run the Project.

How do I load data from local to Snowflake? ›

To ingest data from local files:
  1. Create the destination table.
  2. Use the PUT command to copy the local file(s) into the Snowflake staging area for the table.
  3. Use the COPY command to copy data from the data source into the Snowflake table.
Oct 6, 2022

What factors affect data transfer rate? ›

Factors affecting the speed and quality of internet connection
  • Data transfer technology. ...
  • Network centralizer. ...
  • Other devices and users. ...
  • Network technology and terminal device. ...
  • Other users. ...
  • Location. ...
  • Several operators provide a free speed test for their customers.

What is the best recommended size of file for bulk loading in Snowflake? ›

To optimize the number of parallel operations for a load, we recommend aiming to produce data files roughly 100-250 MB (or larger) in size compressed. Loading very large files (e.g. 100 GB or larger) is not recommended. If you must load a large file, carefully consider the ON_ERROR copy option value.

What are the six workloads of Snowflake? ›

  • Snowflake Workloads Overview.
  • Data Applications.
  • Data Engineering.
  • Data Marketplace.
  • Data Science.
  • Data Warehousing.
  • Marketing Analytics.
  • Unistore.

What are the two types of continuous data? ›

There are two types of continuous variables namely interval and ratio variables.

Why does Snowflake recommend file sizes of 100 250 MB compressed when loading data? ›

Loading data files roughly 100-250 MB in size or larger reduces the overhead charge relative to the amount of total data loaded to the point where the overhead cost is immaterial.

How do you skip an error in a Snowflake? ›

The ON_ERROR = 'skip_file' clause specifies what to do when the COPY command encounters errors in the files. In this case, when the command encounters a data error on any of the records in a file, it skips the file.

How we can load small volumes of data in batches to Snowflake? ›

Bulk Loading Using the COPY Command

This option enables loading batches of data from files already available in cloud storage, or copying (i.e. staging) data files from a local machine to an internal (i.e. Snowflake) cloud storage location before loading the data into tables using the COPY command.

What affects loading time? ›

There are many different factors that affect page load time. The speed at which a page loads depends on the hosting server, amount of bandwidth in transit, and web page design – as well as the number, type, and weight of elements on the page. Other factors include user location, device, and browser type.

What affects loading speed? ›

A number of factors can affect the loading speed of your website, including, but not limited to: The server on which the website is hosted. The size and the number of files of a website. Unresolved Javascript issues.

What causes slow loading? ›

Slow site speeds can result from network congestion, bandwidth throttling and restrictions, data discrimination and filtering, or content filtering. If you notice slow speeds when visiting your site, you can run a traceroute between your computer and your website to test the connection.

What lazy loading means? ›

Lazy loading is a strategy to identify resources as non-blocking (non-critical) and load these only when needed. It's a way to shorten the length of the critical rendering path, which translates into reduced page load times.

How do I reduce the loading time of an image? ›

Optimize your images #
  1. Choose the right image format.
  2. Choose the correct level of compression.
  3. Use Imagemin to compress images.
  4. Replace animated GIFs with video for faster page loads.
  5. Serve responsive images.
  6. Serve images with correct dimensions.
  7. Use WebP images.
  8. Use image CDNs to optimize images.

Does lazy loading improve performance? ›

Lazy loading is the practice of delaying load or initialization of resources or objects until they're actually needed to improve performance and save system resources.

What makes a website load faster? ›

Compress your content.

You can compress your content significantly in order to improve your website performance. Popular web servers such as Apache and IIS use the GZIP compression algorithm to do this automatically on HTML, CSS and JavaScript.

What is the most performant file format for loading data in Snowflake? ›

Loading data into Snowflake is fast and flexible. You get the greatest speed when working with CSV files, but Snowflake's expressiveness in handling semi-structured data allows even complex partitioning schemes for existing ORC and Parquet data sets to be easily ingested into fully structured Snowflake tables.

Should I use a Snowflake internal or external stage to load data? ›

If the files are located in an external cloud location, for example, if you need to load files from AWS S3 into snowflake then an external stage can be used. Unlike Internal stages, loading and unloading the data can be directly done using COPY INTO. Get and Put commands are not supported in external stages.

What ETL used with Snowflake? ›

Snowflake supports both ETL and ELT and works with a wide range of data integration tools, including Informatica, Talend, Tableau, Matillion and others.

Which image format loads fastest? ›

If high loading speeds are important for you, choose WebP as the image format for your website. JPG and PNG are also good choices for the web. If your choice is between JPG or PNG, use JPG for photos and PNG for logos.

What is the most efficient file format? ›

ORC file format

The Optimized Row Columnar (ORC) file format provides a highly efficient way to store data. This format was designed to overcome the limitations of other file formats.

What is the best recommended size of file for bulk loading? ›

General File Sizing Recommendations

To optimize the number of parallel operations for a load, we recommend aiming to produce data files roughly 100-250 MB (or larger) in size compressed. Loading very large files (e.g. 100 GB or larger) is not recommended.

What SQL is Snowflake using? ›

How is It Supported in Snowflake? Snowflake is a data platform and data warehouse that supports the most common standardized version of SQL: ANSI. This means that all of the most common operations are usable within Snowflake.

Is SQL good for ETL? ›

In the first stage of the ETL workflow, extraction often entails database management systems, metric sources, and even simple storage means like spreadsheets. SQL commands can also facilitate this part of ETL as they fetch data from different tables or even separate databases.

Which ETL tool is in high demand? ›

Informatica PowerCenter is one of the best ETL tools on the market. It has a wide range of connectors for cloud data warehouses and lakes, including AWS, Azure, Google Cloud, and SalesForce. Its low- and no-code tools are designed to save time and simplify workflows.


1. Documentation-as-Code: our way of documenting sources of the data platform
2. SharePoint Document Library Tutorial
(Kevin Stratvert)
3. View your dbt documentation as a website
(Kahan Data Solutions)
4. Complete Python Pandas Data Science Tutorial! (Reading CSV/Excel files, Sorting, Filtering, Groupby)
(Keith Galli)
5. Azure Data Factory Mapping Data Flows Tutorial | Build ETL visual way!
(Adam Marczak - Azure for Everyone)
6. Stata: Opening and Importing Data Files
(Stanford University Libraries)
Top Articles
Latest Posts
Article information

Author: Rev. Porsche Oberbrunner

Last Updated: 03/06/2023

Views: 6581

Rating: 4.2 / 5 (53 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Rev. Porsche Oberbrunner

Birthday: 1994-06-25

Address: Suite 153 582 Lubowitz Walks, Port Alfredoborough, IN 72879-2838

Phone: +128413562823324

Job: IT Strategist

Hobby: Video gaming, Basketball, Web surfing, Book restoration, Jogging, Shooting, Fishing

Introduction: My name is Rev. Porsche Oberbrunner, I am a zany, graceful, talented, witty, determined, shiny, enchanting person who loves writing and wants to share my knowledge and understanding with you.