Docsity

Extracting Data using CDC: Push-by-Source and Pre-population Techniques, Lecture notes of Data Warehousing

Partial preview of the text

Download Extracting Data using CDC: Push-by-Source and Pre-population Techniques and more Lecture notes Data Warehousing in PDF only on Docsity!

Introduction to ETL ETL, short for Extract, Transform, andLoad The E, T,^ L^ is^ not^ always

a^ distinct step.

3

Push-by-source CDC Push-by-source^ CDC^ means

the^ source system^ extracts^

only^ the^ changes

since the last extraction.

5

Testing

^ To test push-by-source CDC daily extraction,we will perform the following steps.^ ^ We will create a sales_order table in the sourcedatabase^ ^ We will add some test data (four sales orders and adate) to the data warehouse (dw) database^ ^ Finally we will run the push_sales_order code

6

Populating the Date Dimension Most common Techniques forPopulating Date dimension^ ^ Pre-population^ ^ One date everyday^ ^ Loading the date from the source data

11

Loading Dates from the Source It will store only the dates that areused, saving disk space. Drawbacks: ^ this method is more complex because youmust load all dates to the date dimension fromyour data sources that have dates

17

Loading Dates from the Source(1)USE dw;truncate date_dim;INSERT INTO date_dimSELECT DISTINCTNULL, order_date, MONTHNAME(order_date), MONTH(order_date), QUARTER(order_date), YEAR(order_date), '0000-00-00', '9999-12-31'FROM source.sales_orderWHERE order_date NOT IN(SELECT date FROM date_dim);

18

Loading Dates from the Source(3)  Now, add some sales orders by running the commandUSE source;INSERT INTO sales_order VALUES(21, 1, 3, '2010-11-03', '2010-11-03', 1000), (22, 2, 3, '2010-11-04', '2010-11-04', 1000), (23, 3, 3, '2010-12-05', '2010-12-05', 4000), (24, 4, 3, '2010-12-06', '2010-12-06', 4000);

20

Loading Dates from the Source(4)  The commands load the sales order dates from the sales_order table in the sourcedatabase into the date_dim tableUSE dw;INSERT INTO date_dimSELECT DISTINCTNULL, order_date, MONTHNAME(order_date), MONTH(order_date), QUARTER(order_date), YEAR(order_date), '0000-00-00', '9999-12-31'FROM source.sales_orderWHERE order_date NOT IN(SELECT date FROM date_dim);  Finally, confirm that the four dates from the source are correctly loaded into thedate_dim table.  select * from date_dim \G

21