Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying ETL with Azure Cookbook
  • Table Of Contents Toc
ETL with Azure Cookbook

ETL with Azure Cookbook

By : Christian Cote, Matija Lah, Madina Saitakhmetova
4 (2)
close
close
ETL with Azure Cookbook

ETL with Azure Cookbook

4 (2)
By: Christian Cote, Matija Lah, Madina Saitakhmetova

Overview of this book

ETL is one of the most common and tedious procedures for moving and processing data from one database to another. With the help of this book, you will be able to speed up the process by designing effective ETL solutions using the Azure services available for handling and transforming any data to suit your requirements. With this cookbook, you’ll become well versed in all the features of SQL Server Integration Services (SSIS) to perform data migration and ETL tasks that integrate with Azure. You’ll learn how to transform data in Azure and understand how legacy systems perform ETL on-premises using SSIS. Later chapters will get you up to speed with connecting and retrieving data from SQL Server 2019 Big Data Clusters, and even show you how to extend and customize the SSIS toolbox using custom-developed tasks and transforms. This ETL book also contains practical recipes for moving and transforming data with Azure services, such as Data Factory and Azure Databricks, and lets you explore various options for migrating SSIS packages to Azure. Toward the end, you’ll find out how to profile data in the cloud and automate service creation with Business Intelligence Markup Language (BIML). By the end of this book, you’ll have developed the skills you need to create and automate ETL solutions on-premises as well as in Azure.
Table of Contents (12 chapters)
close
close

Loading data before its transformation

ELT is very similar to ETL, but with a crucial difference: the order of the transform and load steps are inverted. This is very useful with big data in the cloud or when we do not have an ETL tool on-premises. This recipe will be much simpler than the previous one, as we'll implement ELT using a database, so no tools are involved here except for calling the ELT task.

It also relies on the previous recipe, Creating a simple ETL package, since we're going to use the SalesLT.CustomerFullName table data to implement the ELT pattern.

There are essentially two parts to this recipe:

  1. Extract and load data into our data lake. Here, we don't have a real data lake; we're using AdventureWorksLT on Azure to mimic the data lake concept.
  2. Transform the data inside the database using a simple SQL script. We're going to add the FullName column to the SalesLT.Customer table and update it using this script.

Getting ready

This recipe assumes that you have installed SSMS, Visual Studio 2019, and SSIS.

How to do it…

Let's dig into the recipe:

  1. In the SSIS solution, right-click on the SSIS packages folder and select New SSIS package. Rename the package from Package1 to SalesLT.Customer.
  2. Drag and drop Execute SQL Task from the Favorites section of the SSIS toolbox onto the control flow and name it SQL_ELT_SalesLT_Customer.
  3. We're going to add the FullName column to SalesLT.Customer. Open SSMS and connect it to our Azure database. Make sure that the context is set to the AdventureWorksLT database as shown in the following screenshot:
    Figure 2.32 – SSMS AdventureWorksLT database context

    Figure 2.32 – SSMS AdventureWorksLT database context

  4. In the query window, type the following DDL statement:
    ALTER TABLE SalesLT.Customer ADD FullName NVARCHAR(350)
  5. Execute the command and verify that the FullName column has been successfully added in the Object Explorer as shown in the following screenshot:
    Figure 2.33 – SSMS Object Explorer FullName column

    Figure 2.33 – SSMS Object Explorer FullName column

  6. Go back to the SSIS package. Double-click on the SQL_ELT_SalesLT_Customer task to open Execute SQL Task Editor. Set the properties as follows:

    a) Connection: cmgr_etlinazurecookbook.database.windows.net.AdventureWorksLT.ETLAdmin

    b) SQL SourceType: Direct input

    c) SQL Statement:

    UPDATE c
    SET FullName = cfn.FullName
    FROM SalesLT.Customer AS c
    INNER JOIN SalesLT.CustomerFullName as cfn
    ON c.CustomerID = cfn.CustomerID;

    Click on OK to close the editor and go back to the control flow.

  7. Execute the package.
  8. Go back into SSMS, create a new query, and type the following SQL statement:
    SELECT [CustomerID]
           ,[FullName]
          ,[NameStyle]
          ,[Title]
          ,[FirstName]
          ,[MiddleName]
          ,[LastName]
          ,[Suffix]
          ,[CompanyName]
          ,[SalesPerson]
          ,[EmailAddress]
          ,[Phone]
      FROM [SalesLT].[Customer]

    The result should look like the following screenshot:

Figure 2.34 – SSMS Query Editor result

Figure 2.34 – SSMS Query Editor result

How it works…

This recipe showed you the pattern of ELT. Data was extracted from the source first, then loaded into the database (as we saw in the previous recipe, Creating a simple ETL package). We then transformed the SalesLT.Customer data by using already loaded data.

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
ETL with Azure Cookbook
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon