Snowflake Data Ingestion Strategies Decoded: A Guided Tour for Data Engineers

In today’s digital era, data is the linchpin of business intelligence. Therefore, having expertise in the data ingestion process is invaluable. Snowflake, an industry-leading cloud-based data warehousing platform, offers a spectrum of data ingestion techniques. This article serves as your guide to that subject, shedding light on these diverse methods, dissecting their unique merits, practical applications, and key factors for consideration. Armed with this knowledge, you can identify the technique that best fits your business requirements.

Demystifying Data Ingestion in Snowflake

Snowflake’s flexible framework empowers its users to ingest a myriad of data forms – from structured to semi-structured data, encompassing traditional databases to JSON, Avro, or XML files. The capacity to fuse and process these varied data types makes Snowflake a game-changer in the data warehousing landscape.

Snowflake’s main ingestion techniques can be classified into:

  • Batch Loading
  • Continuous Data Loading

Each of these methodologies is distinct in their complexity, processing speed, and compatibility with various data types. Let’s delve into the nitty-gritty of each approach.

Batch Loading

Batch loading is a technique of ingesting data in substantial ‘batches’ at preset time intervals. This method fits like a glove when you are handling copious data amounts that do not require real-time analysis. Its strength lies in the efficient handling of voluminous data. 

However, it is not designed for applications demanding instant insights, due to inherent delays between data generation and its readiness for analysis.  You can attempt to run your batches more frequently, but you must be aware of the maximum time it takes for the job to run to avoid your jobs overlapping.  Realistically, when latency matters, using Snowpipe for continuous loading is a more elegant solution. 

There are two common ways to implement batch loading in Snowflake. 

  1. COPY INTO command: This is a push technique whereby you issue a SQL command to load data files directly from a cloud-based stage (like Amazon S3, Google Cloud Storage, or Microsoft Azure Storage) or a local file system in large batches.  You can think of this as scripting a manual process into a time-based periodic job. 
  1. Snowpipe: This native Snowflake data ingestion service immediately loads data as it lands in a cloud-based staging area such as an Amazon S3 or Google Cloud Storage bucket. While its typical use case is continuous, near-real-time loading, Snowpipe can also cater to batch loading requirements.

For effective batch loading in Snowflake, consider these best practices:

  • Opt for larger batch sizes: Bigger batches enhance efficiency by reducing the number of separate network transfers and load operations. If you choose Snowpipe, Snowflake recommends 100 MB – 250 MB file sizes to balance cost and performance.  This is because you accrue a per-file charge on top of the compute costs. 
  • Compress your data: Compressed data files consume less network bandwidth and storage, often leading to faster loading times. COPY INTO and Snowpipe natively support a number of common compression standards.
  • Eliminate unnecessary data: Prune data that isn’t needed for your analysis before loading. This can greatly reduce the data volume, enhancing efficiency. 
  • Leverage parallel loading: If dealing with many files, capitalize on Snowflake’s parallel loading support to expedite the loading process.  To do this you simply make sure your data warehouse is sufficiently large.  Of course, this will drive up cost and beyond a certain size is reached the performance returns will diminish.

Continuous Data Loading

Unlike batch loading, continuous data loading caters to near real-time data ingestion. It constitutes ingesting data in small, frequent batches, making it a perfect match for scenarios demanding instant data availability. Continuous loading is required for real-time analytics and applications that hinge on up-to-the-second data, like fraud detection or real-time monitoring systems, or for near-real-time use cases where required latency is measured in minutes. 

In exchange for obtaining rapid data availability, continuous loading will demand more resources and sophisticated management than batch loading.

Though services like Snowpipe are often employed for data ingestion, they may not be robust enough for large-scale real-time data ingestion

  • Snowpipe places semi-structured data into a VARIANT column in Snowflake, which can be challenging for SQL users who typically prefer structured tables. This necessitates additional ingestion steps like flattening and schema mapping.
  • While this data structuring can be achieved via (batch) data prep jobs on Snowflake, it involves extra work and introduces latency, which contradicts the objective of continuous loading.
  • Snowpipe does provide an error notification feature, but it’s significantly limited and mainly sends notifications only on failures via Amazon SNS. This makes it less practical for many use cases.
  • The platform lacks strong observability features, hence it is often monitored by users who wait for dashboards to break or transformation models to fail, indicating pipeline issues.
  • In the absence of robust integrated monitoring or observability, users are compelled to manually track whether the target tables are receiving a steady data flow to identify any potential pipeline problems.
  • Implementing quality checks or filters to catch bad data (duplicates, unexpected NULLs, data skew) before it lands in Snowflake is another external step not covered by Snowpipe. 
  • Snowpipe does not monitor or adapt to schema changes automatically. If you just capture the entire JSON in a variant column you are just pushing the problem onto the data consumer (their queries will break, or added columns will be missed).  If you have build a data prep job to structure the data, then that job may break or create new columns. 
  • Lastly, optimizing file sizes on S3 or GCS is critical, as small files drive up the ingestion cost but excessively large files hurt performance.

Continuous Data Ingestion with Upsolver

Upsolver is a data ingestion system with some unique attributes. At its core it is a stream processor so it is built for continuous data flows. It includes a transformation engine that allows for in-stream data preparation such as flattening, filtering, hashing and the like.  It is also highly instrumented,  capturing 100s of metrics about data, schema, and pipeline performance. Lastly it is cloud-native so it deploys easily and scales automatically.

In contrast to the native options provided by Snowflake, Upsolver offers an optimal solution with these advantages:

  1. Data and Pipeline Observability: Unlike Snowpipe, Upsolver provides built-in monitoring of the in-flow data, mitigating the need for separate solutions or post-ingestion checks to detect issues with the data or pipeline performance.
  2. Quality: Upsolver facilitates rule-based quality checks during the ingestion process, barring the entry of bad data.
  3. Schema Management: Upsolver adapts automatically to evolving schema, whereas in Snowpipe, schema mapping and handling become additional ingestion steps. This means that changes in upstream data structure do not break pipelines or necessitate manual intervention.
  4. Scalability: Upsolver, as a cloud-native service, scales elastically, offering multi-cluster support for workload isolation. This capability is advantageous in handling high data volumes and traffic, ensuring optimal performance even in demanding scenarios. By automatically reacting to the workload and leveraging low-cost spot compute instances, Upsolver minimizes ingestion costs. 
  5. Developer Simplicity and Flexibility: Upsolver provides multiple ways to build ingestion pipelines, from a no-code wizard to full-code scripting using SQL or Python.  
  6. Workflow Automation: Upsolver considerably curtails manual tasks. It supports the automation of several tasks, including programmatic deployment (CI/CD), CLI, Python SDK, version control, and rollback. This not only minimizes the possibility of human error but also greatly amplifies productivity.
  7. Security: With the power to filter data in-stream and mask sensitive data, Upsolver guarantees that your data remains secure. This not only safeguards data privacy but also complies with regulatory requirements.

In essence, Upsolver offers an all-encompassing suite of features for continuous data loading, providing robust support for real-time ingestion, schema evolution, data security, scalability, and observability. It considerably eases the data ingestion process, thereby enhancing performance and productivity.

Selecting the Right Ingestion Method

The choice between these ingestion methods hinges on several factors. If you deal with large data volumes where real-time insights are not obligatory, batch loading can prove to be the most resource-efficient method. Conversely, for applications demanding immediate insights, continuous data loading becomes indispensable. Lastly, for semi-structured data types, you can choose Snowflake’s semi-structured data ingestion capabilities and then have users flatten the data or query the VARIANT column directly, or use a tool like Upsolver that can deliver structured data as part of the ingestion process.  

Closing Thoughts

In essence, Snowflake’s versatile and diverse ingestion techniques equip users with a toolkit to handle a broad spectrum of data ingestion scenarios. By understanding the strengths and limitations of each method, businesses can choose the path that aligns best with their data strategy and operational objectives.

Published in: Blog , Cloud Architecture
Upsolver Team
Upsolver Team

Upsolver enables any data engineer to build continuous SQL data pipelines for cloud data lake. Our team of expert solution architects is always available to chat about your next data project. Get in touch

Keep up with the latest cloud best practices and industry trends

Get weekly insights from the technical experts at Upsolver.



All Templates

Explore our expert-made templates & start with the right one for you.