Azure Databricks Cookbook

Book description

Get to grips with building and productionizing end-to-end big data solutions in Azure and learn best practices for working with large datasets

Key Features

  • Integrate with Azure Synapse Analytics, Cosmos DB, and Azure HDInsight Kafka Cluster to scale and analyze your projects and build pipelines
  • Use Databricks SQL to run ad hoc queries on your data lake and create dashboards
  • Productionize a solution using CI/CD for deploying notebooks and Azure Databricks Service to various environments

Book Description

Azure Databricks is a unified collaborative platform for performing scalable analytics in an interactive environment. The Azure Databricks Cookbook provides recipes to get hands-on with the analytics process, including ingesting data from various batch and streaming sources and building a modern data warehouse.

The book starts by teaching you how to create an Azure Databricks instance within the Azure portal, Azure CLI, and ARM templates. You’ll work through clusters in Databricks and explore recipes for ingesting data from sources, including files, databases, and streaming sources such as Apache Kafka and EventHub. The book will help you explore all the features supported by Azure Databricks for building powerful end-to-end data pipelines. You'll also find out how to build a modern data warehouse by using Delta tables and Azure Synapse Analytics. Later, you’ll learn how to write ad hoc queries and extract meaningful insights from the data lake by creating visualizations and dashboards with Databricks SQL. Finally, you'll deploy and productionize a data pipeline as well as deploy notebooks and Azure Databricks service using continuous integration and continuous delivery (CI/CD).

By the end of this Azure book, you'll be able to use Azure Databricks to streamline different processes involved in building data-driven apps.

What you will learn

  • Read and write data from and to various Azure resources and file formats
  • Build a modern data warehouse with Delta Tables and Azure Synapse Analytics
  • Explore jobs, stages, and tasks and see how Spark lazy evaluation works
  • Handle concurrent transactions and learn performance optimization in Delta tables
  • Learn Databricks SQL and create real-time dashboards in Databricks SQL
  • Integrate Azure DevOps for version control, deploying, and productionizing solutions with CI/CD pipelines
  • Discover how to use RBAC and ACLs to restrict data access
  • Build end-to-end data processing pipeline for near real-time data analytics

Who this book is for

This recipe-based book is for data scientists, data engineers, big data professionals, and machine learning engineers who want to perform data analytics on their applications. Prior experience of working with Apache Spark and Azure is necessary to get the most out of this book.

Table of contents

  1. Azure Databricks Cookbook
  2. Contributors
  3. About the authors
  4. About the reviewers
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
    4. Download the color images
    5. Conventions used
    6. Sections
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
      5. See also
    7. Get in touch
    8. Share Your Thoughts
  6. Chapter 1: Creating an Azure Databricks Service
    1. Technical requirements
    2. Creating a Databricks workspace in the Azure portal
      1. Getting ready
      2. How to do it…
      3. How it works…
    3. Creating a Databricks service using the Azure CLI (command-line interface)
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
    4. Creating a Databricks service using Azure Resource Manager (ARM) templates
      1. Getting ready
      2. How to do it…
      3. How it works…
    5. Adding users and groups to the workspace
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
    6. Creating a cluster from the user interface (UI)
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
    7. Getting started with notebooks and jobs in Azure Databricks
      1. Getting ready
      2. How to do it…
      3. How it works…
    8. Authenticating to Databricks using a PAT
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
  7. Chapter 2: Reading and Writing Data from and to Various Azure Services and File Formats
    1. Technical requirements
    2. Mounting ADLS Gen2 and Azure Blob storage to Azure DBFS
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
    3. Reading and writing data from and to Azure Blob storage
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
    4. Reading and writing data from and to ADLS Gen2
      1. Getting ready
      2. How to do it…
      3. How it works…
    5. Reading and writing data from and to an Azure SQL database using native connectors
      1. Getting ready
      2. How to do it…
      3. How it works…
    6. Reading and writing data from and to Azure Synapse SQL (dedicated SQL pool) using native connectors 
      1. Getting ready
      2. How to do it…
      3. How it works…
    7. Reading and writing data from and to Azure Cosmos DB 
      1. Getting ready
      2. How to do it…
      3. How it works…
    8. Reading and writing data from and to CSV and Parquet 
      1. Getting ready
      2. How to do it…
      3. How it works…
    9. Reading and writing data from and to JSON, including nested JSON 
      1. Getting ready
      2. How to do it…
      3. How it works…
  8. Chapter 3: Understanding Spark Query Execution
    1. Technical requirements
    2. Introduction to jobs, stages, and tasks
      1. Getting ready
      2. How to do it…
      3. How it works…
    3. Checking the execution details of all the executed Spark queries via the Spark UI
      1. Getting ready
      2. How to do it…
      3. How it works…
    4. Deep diving into schema inference
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
    5. Looking into the query execution plan
      1. Getting ready
      2. How to do it…
      3. How it works…
    6. How joins work in Spark 
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
    7. Learning about input partitions 
      1. Getting ready
      2. How to do it…
      3. How it works…
    8. Learning about output partitions 
      1. Getting ready
      2. How to do it…
      3. How it works…
    9. Learning about shuffle partitions
      1. Getting ready
      2. How to do it…
      3. How it works…
    10. Storage benefits of different file types
      1. Getting ready
      2. How to do it…
      3. How it works…
  9. Chapter 4: Working with Streaming Data
    1. Technical requirements
    2. Reading streaming data from Apache Kafka
      1. Getting ready
      2. How to do it…
      3. How it works…
    3. Reading streaming data from Azure Event Hubs
      1. Getting ready
      2. How to do it…
      3. How it works…
    4. Reading data from Event Hubs for Kafka
      1. Getting ready
      2. How to do it…
      3. How it works…
    5. Streaming data from log files
      1. Getting ready
      2. How to do it…
      3. How it works…
    6. Understanding trigger options
      1. Getting ready
      2. How to do it…
      3. How it works…
    7. Understanding window aggregation on streaming data
      1. Getting ready
      2. How to do it…
      3. How it works…
    8. Understanding offsets and checkpoints
      1. Getting ready
      2. How to do it…
      3. How it works…
  10. Chapter 5: Integrating with Azure Key Vault, App Configuration, and Log Analytics
    1. Technical requirements
    2. Creating an Azure Key Vault to store secrets using the UI
      1. Getting ready
      2. How to do it…
      3. How it works…
    3. Creating an Azure Key Vault to store secrets using ARM templates
      1. Getting ready
      2. How to do it…
      3. How it works…
    4. Using Azure Key Vault secrets in Azure Databricks
      1. Getting ready
      2. How to do it…
      3. How it works…
    5. Creating an App Configuration resource
      1. Getting ready
      2. How to do it…
      3. How it works…
    6. Using App Configuration in an Azure Databricks notebook
      1. Getting ready
      2. How to do it…
      3. How it works…
    7. Creating a Log Analytics workspace
      1. Getting ready
      2. How to do it…
      3. How it works…
    8. Integrating a Log Analytics workspace with Azure Databricks
      1. Getting ready
      2. How to do it…
      3. How it works…
  11. Chapter 6: Exploring Delta Lake in Azure Databricks
    1. Technical requirements
    2. Delta table operations – create, read, and write
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
    3. Streaming reads and writes to Delta tables
      1. Getting ready
      2. How to do it…
      3. How it works…
    4. Delta table data format
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
    5. Handling concurrency
      1. Getting ready
      2. How to do it…
      3. How it works…
    6. Delta table performance optimization
      1. Getting ready
      2. How to do it…
      3. How it works…
    7. Constraints in Delta tables
      1. Getting ready
      2. How to do it…
      3. How it works…
    8. Versioning in Delta tables
      1. Getting ready
      2. How to do it…
      3. How it works…
  12. Chapter 7: Implementing Near-Real-Time Analytics and Building a Modern Data Warehouse
    1. Technical requirements
    2. Understanding the scenario for an end-to-end (E2E) solution
      1. Getting ready
      2. How to do it…
      3. How it works…
    3. Creating required Azure resources for the E2E demonstration
      1. Getting ready
      2. How to do it…
      3. How it works…
    4. Simulating a workload for streaming data
      1. Getting ready
      2. How to do it…
      3. How it works…
    5. Processing streaming and batch data using Structured Streaming
      1. Getting ready
      2. How to do it…
      3. How it works…
    6. Understanding the various stages of transforming data
      1. Getting ready
      2. How to do it…
      3. How it works…
    7. Loading the transformed data into Azure Cosmos DB and a Synapse dedicated pool
      1. Getting ready
      2. How to do it…
      3. How it works…
    8. Creating a visualization and dashboard in a notebook for near-real-time analytics
      1. Getting ready
      2. How to do it…
      3. How it works…
    9. Creating a visualization in Power BI for near-real-time analytics
      1. Getting ready
      2. How to do it…
      3. How it works…
    10. Using Azure Data Factory (ADF) to orchestrate the E2E pipeline
      1. Getting ready
      2. How to do it…
      3. How it works…
  13. Chapter 8: Azure Databricks SQL Analytics
    1. Technical requirements
    2. How to create a user in SQL Analytics
      1. Getting ready
      2. How to do it…
      3. How it works…
    3. Creating SQL endpoints
      1. Getting ready
      2. How to do it…
      3. How it works…
    4. Granting access to objects to the user
      1. Getting ready
      2. How to do it…
      3. How it works…
    5. Running SQL queries in SQL Analytics
      1. Getting ready
      2. How to do it…
      3. How it works…
    6. Using query parameters and filters
      1. Getting ready
      2. How to do it…
      3. How it works…
    7. Introduction to visualizations in SQL Analytics
      1. Getting ready
      2. How to do it…
    8. Creating dashboards in SQL Analytics
      1. Getting ready
      2. How to do it…
      3. How it works…
    9. Connecting Power BI to SQL Analytics
      1. Getting ready
      2. How to do it…
  14. Chapter 9: DevOps Integrations and Implementing CI/CD for Azure Databricks
    1. Technical requirements
    2. How to integrate Azure DevOps with an Azure Databricks notebook
      1. Getting ready
      2. How to do it…
    3. Using GitHub for Azure Databricks notebook version control
      1. Getting ready
      2. How to do it…
      3. How it works…
    4. Understanding the CI/CD process for Azure Databricks
      1. Getting ready
      2. How to do it…
      3. How it works…
    5. How to set up an Azure DevOps pipeline for deploying notebooks
      1. Getting ready
      2. How to do it…
      3. How it works…
    6. Deploying notebooks to multiple environments
      1. Getting ready
      2. How to do it…
      3. How it works…
    7. Enabling CI/CD in an Azure DevOps build and release pipeline
      1. Getting ready
      2. How to do it…
    8. Deploying an Azure Databricks service using an Azure DevOps release pipeline
      1. Getting ready
      2. How to do it…
  15. Chapter 10: Understanding Security and Monitoring in Azure Databricks
    1. Technical requirements
    2. Understanding and creating RBAC in Azure for ADLS Gen-2
      1. Getting ready
      2. How to do it…
    3. Creating ACLs using Storage Explorer and PowerShell
      1. Getting ready
      2. How to do it…
      3. How it works…
    4. How to configure credential passthrough
      1. Getting ready
      2. How to do it…
    5. How to restrict data access to users using RBAC
      1. Getting ready
      2. How to do it…
    6. How to restrict data access to users using ACLs
      1. Getting ready
      2. How to do it…
    7. Deploying Azure Databricks in a VNet and accessing a secure storage account
      1. Getting ready
      2. How to do it…
      3. There's more…
    8. Using Ganglia reports for cluster health
      1. Getting ready
      2. How to do it…
    9. Cluster access control
      1. Getting ready
      2. How to do it…
    10. Why subscribe?
  16. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Share Your Thoughts

Product information

  • Title: Azure Databricks Cookbook
  • Author(s): Phani Raj, Vinod Jaiswal
  • Release date: September 2021
  • Publisher(s): Packt Publishing
  • ISBN: 9781789809718