etl: putting it together

39
ETL: Putting It Together ETL: Putting It Together -Prof. Zarna Barai -Unit 4, Chap 8

Upload: others

Post on 12-Dec-2021

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ETL: Putting It Together

ETL: Putting It TogetherETL: Putting It Together-Prof. Zarna Barai

-Unit 4, Chap 8

Page 2: ETL: Putting It Together

2/4/2014Private & Confidential

2

Page 3: ETL: Putting It Together

Designing The Staging Area Contents

• The staging area will hold the data extracted directly from the ACME_POS.

• Staging area can be in the same database as the

2/4/2014Private & Confidential

3

• Staging area can be in the same database as the target, or in different database, depending on various factors such as the size & space issues & availability of the database.

• For Acme Toys & Gizmos organization, We will create a staging area as single table in target database schema.

Page 4: ETL: Putting It Together

Target Structure

2/4/2014Private & Confidential

4

SALES PRODUCT STORES DATE

Quantity SKU Name Date of SaleQuantity SKU Name Date of Sale

Sales Amount NAME Number

List Price Address1

Department Address2

Category City

Brand State

Zip Postal Code

Country

Region

Page 5: ETL: Putting It Together

Building The Staging Area Table With

Data Object Editor• Login into the Design Center.

• Navigate to Databases | Oracle | ACME_DWH | Tables node , Right click & select new.

2/4/2014Private & Confidential

5

Tables node , Right click & select new.

• Object Editor Window appears.

• Create a new table with name POS_TRANS_STAGE

Page 6: ETL: Putting It Together

2/4/2014Private & Confidential

6

Page 7: ETL: Putting It Together

2/4/2014Private & Confidential

7

Page 8: ETL: Putting It Together

Tabs Data Object Editor for Table

• Name• Columns• Constraints

▫ Check constraint

2/4/2014Private & Confidential

8

▫ Check constraint▫ Foreign key▫ Primary key▫ Unique key

• Indexes• Partitions• Attribute Sets• Data Rules• Data Viewer

Page 9: ETL: Putting It Together

2/4/2014Private & Confidential

9

Page 10: ETL: Putting It Together

Creating a Mapping

• Login into the design center, navigate to the ACME_DW_PROJECT | Databases | Oracle | ACME_DWH | Mappings node.

2/4/2014Private & Confidential

10

ACME_DWH | Mappings node.

• Right click on the Mappings node and select new.

• This will launch the “Create Mapping” window

• After providing the name and description of the mapping Editor window appears.

Page 11: ETL: Putting It Together

Creating a Mapping

2/4/2014Private & Confidential

11

Page 12: ETL: Putting It Together

To start with• Layout

▫ Sources on the left

▫ Final targets on the right

2/4/2014Private & Confidential

12

▫ Transformation in between the source and target.

• Can we directly connect source to target ?

• What transformations to be included ?

▫ Joiner operator

▫ Aggregation operator

▫ Transformation operator

Page 13: ETL: Putting It Together

Adding Source

Tables

• 2 ways to add source tables in mapping window of mapping editor:

2/4/2014Private & Confidential

13

mapping editor:• Using Explorer

window

• Using Palette

• Similarly add the target stage table

Page 14: ETL: Putting It Together

2/4/2014Private & Confidential

14

Page 15: ETL: Putting It Together

Joiner Operator

• Drop joiner operator from the palette window to the canvas area.

• Define the properties for joiner operator.

2/4/2014Private & Confidential

15

• Define the properties for joiner operator.

▫ Double click on joiner operator in the mapping window, joiner editor window appears.

▫ Select “Groups” tab & add one input group for each source table selected.

• Connect the source table operators to the joiner operator table

Page 16: ETL: Putting It Together

2/4/2014Private & Confidential

16

Page 17: ETL: Putting It Together

2/4/2014Private & Confidential

17

Page 18: ETL: Putting It Together

2/4/2014Private & Confidential

18

Page 19: ETL: Putting It Together

Defining The Properties for Joining

• Select the Joiner Operator from the canvas area.

• Verify that the, the properties window will now display the properties of joiner operator.

2/4/2014Private & Confidential

19

display the properties of joiner operator.

• Select the property “join condition” and click the button which displays three dots on it.

• The Expression builder window appears.

Page 20: ETL: Putting It Together

2/4/2014Private & Confidential

20

Page 21: ETL: Putting It Together

2/4/2014Private & Confidential

21

Page 22: ETL: Putting It Together

Adding The Aggregator Operator

• We need aggregation to add up sales quantities and dollar amounts for every product.

• Steps:

2/4/2014Private & Confidential

22

• Steps:▫ Drag the aggregator operator into the canvas to

the right of the joiner operator.▫ Connect output attributes from the joiner operator

to the input of the aggregator operator.▫ Define properties for aggregator operator.▫ Connect the output of the aggregator operator to

the POS_TRANS_STAGE.

Page 23: ETL: Putting It Together

2/4/2014Private & Confidential

23

Page 24: ETL: Putting It Together

2/4/2014Private & Confidential

24

Page 25: ETL: Putting It Together

Applying Transformation to Date

• Drag the Transformation operator from the palette window and drop it on the canvas between the joiner operator and aggregator

2/4/2014Private & Confidential

25

between the joiner operator and aggregator operator, near DATE_SOLD.

• Add Transformation window appears

Page 26: ETL: Putting It Together

2/4/2014Private & Confidential

26

Page 27: ETL: Putting It Together

2/4/2014Private & Confidential

27

Page 28: ETL: Putting It Together

2/4/2014Private & Confidential

28

Page 29: ETL: Putting It Together

2/4/2014Private & Confidential

29

Page 30: ETL: Putting It Together

2/4/2014Private & Confidential

30

Page 31: ETL: Putting It Together

Setting The Properties Of Aggregator

• Select the Aggregator operator from the canvas area• Select the group by clause property of the aggregator

from mapping properties window.• Click on the button which shows three dots on it.

2/4/2014Private & Confidential

31

• Click on the button which shows three dots on it.• Expression builder window appears.

▫ Enter the grouping details

• Add 2 new output attributes to the aggregator▫ Sales quantity &▫ Amount

Page 32: ETL: Putting It Together

2/4/2014Private & Confidential

32

Page 33: ETL: Putting It Together

2/4/2014Private & Confidential

33

Page 34: ETL: Putting It Together

Right-click on the OUTGRP1 attribute group of the AGGREGATOR

2/4/2014Private & Confidential

34

AGGREGATOR operator and select Open Details... from the pop up.

Page 35: ETL: Putting It Together

2/4/2014Private & Confidential

35

Page 36: ETL: Putting It Together

• select SALES_QUANTITY attributes from the OUTGRP1 group of the Aggregator.

• In the Properties window of the Mapping Editor, select expression property & click on the button which has three dots.

2/4/2014Private & Confidential

36

has three dots.

• in the Expression window, select the SUM( ) function, ALL from All/distinct menu & click on “Use Above Values “.

• Repeat the same procedure for attribute AMOUNT

Page 37: ETL: Putting It Together

Connect To the Target Stage Table

• Connect the output attributes of the aggregator operator to the target input

2/4/2014Private & Confidential

37

Page 38: ETL: Putting It Together

2/4/2014Private & Confidential

38

Page 39: ETL: Putting It Together

2/4/2014Private & Confidential

39