Book Image

Data Engineering with Apache Spark, Delta Lake, and Lakehouse

By : Manoj Kukreja
5 (2)
Book Image

Data Engineering with Apache Spark, Delta Lake, and Lakehouse

5 (2)
By: Manoj Kukreja

Overview of this book

In the world of ever-changing data and schemas, it is important to build data pipelines that can auto-adjust to changes. This book will help you build scalable data platforms that managers, data scientists, and data analysts can rely on. Starting with an introduction to data engineering, along with its key concepts and architectures, this book will show you how to use Microsoft Azure Cloud services effectively for data engineering. You'll cover data lake design patterns and the different stages through which the data needs to flow in a typical data lake. Once you've explored the main features of Delta Lake to build data lakes with fast performance and governance in mind, you'll advance to implementing the lambda architecture using Delta Lake. Packed with practical examples and code snippets, this book takes you through real-world examples based on production scenarios faced by the author in his 10 years of experience working with big data. Finally, you'll cover data lake deployment strategies that play an important role in provisioning the cloud resources and deploying the data pipelines in a repeatable and continuous way. By the end of this data engineering book, you'll know how to effectively deal with ever-changing data and create scalable data pipelines to streamline data science, ML, and artificial intelligence (AI) tasks.
Table of Contents (17 chapters)
1
Section 1: Modern Data Engineering and Tools
5
Section 2: Data Pipelines and Stages of Data Engineering
11
Section 3: Data Engineering Challenges and Effective Deployment Strategies

Changing data in an existing Delta Lake table

In the previous section, we saw how new data can be written to a Delta Lake table. But transactions in Delta Lake are not only about new data – we may also need to update and delete data as well. In this section, we will find out how the data lake reacts to changes in existing data:

  1. To highlight the effect of changes to Delta Lake tables, we will work with a sample row in the store_orders table as follows:
    %sql
    SELECT * FROM store_orders WHERE order_number=5; 

    This results in the following output:

    Figure 6.22 – Checking the data in the sales_orders table for the sample row

  2. Now, we will update this row and change the sale_ price value from 98.41 to 90.50:
    %sql
    UPDATE store_orders SET sale_price=90.50 WHERE order_number=5;
  3. Check if the sale_ price value got updated in the store_orders table:
    %sql
    SELECT * FROM store_orders WHERE order_number=5;

    This results in the following output:

    Figure 6.23 – Checking the...