





























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






























a^ distinct step.
3
the^ source system^ extracts^
only^ the^ changes
since the last extraction.
5
^ 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
11
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