Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Data Engineering with Scala and Spark

You're reading from  Data Engineering with Scala and Spark

Product type Book
Published in Jan 2024
Publisher Packt
ISBN-13 9781804612583
Pages 300 pages
Edition 1st Edition
Languages
Authors (3):
Eric Tome Eric Tome
Profile icon Eric Tome
Rupam Bhattacharjee Rupam Bhattacharjee
Profile icon Rupam Bhattacharjee
David Radford David Radford
Profile icon David Radford
View More author details

Table of Contents (21) Chapters

Preface Part 1 – Introduction to Data Engineering, Scala, and an Environment Setup
Chapter 1: Scala Essentials for Data Engineers Chapter 2: Environment Setup Part 2 – Data Ingestion, Transformation, Cleansing, and Profiling Using Scala and Spark
Chapter 3: An Introduction to Apache Spark and Its APIs – DataFrame, Dataset, and Spark SQL Chapter 4: Working with Databases Chapter 5: Object Stores and Data Lakes Chapter 6: Understanding Data Transformation Chapter 7: Data Profiling and Data Quality Part 3 – Software Engineering Best Practices for Data Engineering in Scala
Chapter 8: Test-Driven Development, Code Health, and Maintainability Chapter 9: CI/CD with GitHub Part 4 – Productionalizing Data Engineering Pipelines – Orchestration and Tuning
Chapter 10: Data Pipeline Orchestration Chapter 11: Performance Tuning Part 5 – End-to-End Data Pipelines
Chapter 12: Building Batch Pipelines Using Spark and Scala Chapter 13: Building Streaming Pipelines Using Spark and Scala Index Other Books You May Enjoy

Creating a serving layer

The final step in our pipeline will be a process to write to our serving layer, referred to as the Gold layer.

Refer to the following code:

private def writeDelta(df: DataFrame, tableName: String) = {
     df.write
       .format("delta")
       .mode("overwrite")
       .save(s"${target}${tableName}")
   }

This code defines a reusable function, writeDelta, that takes a DataFrame, df, and a table name, tableName, as arguments. It writes the DataFrame to a Delta Lake table with the specified table name, overwriting the existing data if it already exists.

Next, have a look at the following code:

val silverSource: String = "./src/main/scala/com/packt/dewithscala/chapter13/data/silver/ silver_devices"
val target: String = "./src/main/scala/com/packt/dewithscala...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}