1. Trang chủ
  2. » Công Nghệ Thông Tin

SAS Data Integration Studio 3.3- P43 potx

5 180 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 564,81 KB

Nội dung

Using Slowly Changing Dimensions Create and Populate the Job 205 In this example, three additional columns will be specified for CUSTOMER_SCD: two change-tracking columns (VALID_FROM_DTTM and VALID_TO_DTTM) and a column for generated keys (CUSTOMER_GEN_KEY). CUSTOMER_TRANS and CUSTOMER_SCD have been registered in a current metadata repository. You have selected a default SAS application server for SAS Data Integration Studio, as described in “Selecting a Default SAS Application Server” on page 96. This server can access all tables that are used in the job. The main metadata repository is under change-management control. For details about change management, see “Working with Change Management” on page 113. It is assumed that you have started SAS Data Integration Studio and have opened the appropriate metadata profile. The first task is to check out any existing metadata that must be updated for the current job. Check Out Existing Metadata That Must Be Updated You do not have to check out the metadata for a table in order to add it as a source or a target in a job. However, the metadata for the CUSTOMER_SCD table must be checked out because (a) we assume that the metadata for this table was created and checked in earlier, and (b) the metadata for the table must be updated for the current job. Follow these steps to check out existing metadata: 1 On the SAS Data Integration Studio desktop, select the Inventory tab. 2 In the Inventory tree, open the Tables folder. 3 Select the table that must be updated for the current job: CUSTOMER_SCD. 4 Select Project Check Out from the menu bar. The metadata for this table will be checked out and will appear in the Project tree. The next task is to create and populate the job. Create and Populate the Job Follow these steps to populate the job Load the Customer Dimension : 1 In SAS Data Integration Studio, in the Shortcuts pane, click Process Designer to start the New Job Wizard. 2 In the New Job Wizard, type the job name Load the Organization Dimension and click Finish. An empty Process Designer window is displayed. 3 In the tree view, click the Process Library tab, then expand the Data Transforms folder. 4 In the Data Transforms folder, click and drag SCD Type 2 Loader into the Process Designer window. Release the mouse button to display the SCD Type 2 Loader transformation template in the Process Designer window for the new job. The template displays with drop zones for a source and a target. 5 In the tree view, select the Inventory tab. 6 In the Inventory tree, open the Tables folder. 7 In the Tables folder, click and drag the CUSTOMER_TRANS table into the source drop area of the SCD Type 2 Loader. 8 In the tree view, click the Project tab. 206 Add SCD Columns to the Dimension Table Chapter 12 9 In the Project tree, click and drag CUSTOMER_SCD into the target drop area of the SCD Type 2 Loader transformation. The job is now fully populated with tables and transformations, as shown in the following display. Display 12.5 Fully Populated Job for Loading the Dimension Table CUSTOMER_SCD The next step is to add tracking columns and a generated key column to the CUSTOMER_SCD table. Add SCD Columns to the Dimension Table Follow these steps to add tracking columns and a generated key column to the CUSTOMER_SCD table: 1 In the Process Designer window, double-click the icon for the CUSTOMER_SCD table to display its properties window. 2 In the properties window, click the Columns tab. Initially, the CUSTOMER_SCD dimension table was created with the same columns as the source table CUSTOMER_TRANS. (These columns are shown in Display 12.4 on page 204.) To implement slowly changing dimensions, the dimension table needs three new columns. 3 To add the first new column, click CUSTOMER_ID, then click New. A new untitled column appears beneath CUSTOMER_ID. 4 Replace the default name of the new column with the name VALID_FROM_DTTM. This column will contain the date and time that each row was physically loaded into the table. When the job is run, data will be provided for this column by the SCD Type 2 Loader. 5 In the row for VALID_FROM_DTTM, double-click the Type column and select Numeric. 6 In the row for VALID_FROM_DTTM, double-click the Format column and type Datetime20 7 In the row for VALID_FROM_DTTM, click New. A new untitled column appears beneath VALID_FROM_DTTM. 8 Replace the default name of the second new column with the name VALID_TO_DTTM. This column will contain the date and time that each row was Using Slowly Changing Dimensions Specify the Primary Key for the Dimension Table 207 superseded by a new current row. When the job is run, data will be provided for this column by the SCD Type 2 Loader. 9 In the row for VALID_TO_DTTM, specify the Numeric type and the Datetime20. format. 10 To add the third new column, click New and replace the default column name with the name CUSTOMER_GEN_KEY. This column will provide unique key values for all of the rows in the table. The new key values will be generated by the SCD Type 2 Loader. 11 Press the TAB key twice, then double click and select the Numeric data type. 12 Press the TAB key once, then click and type 12., which is a numeric format. 13 Click the row number on the far left for the row CUSTOMER_GEN_KEY and drag the column up to position number one. The columns of the dimension table are now configured for slowly changing dimensions, as shown in the following display. Display 12.6 Columns in the Dimension Table 14 Click Apply to save your changes. The next step is to designate the generated column as the primary key for the dimension table. Specify the Primary Key for the Dimension Table Follow these steps to designate the generated column as the primary key for the dimension table: 1 In the properties window for the CUSTOMER_SCD table, click the Keys tab. Locate the New button in the left pane of the tab. 208 Specify the Business Key for the SCD Loader Chapter 12 2 Click the down arrow to the right of the New button and select Primary Key from the pull-down menu. Default metadata for a primary key appears. 3 In the right pane of the tab, select the CUSTOMER_GEN_KEY column, then click the right arrow. The CUSTOMER_GEN_KEY column is now specified as the primary key of the dimension table, as shown in the following display. Display 12.7 Primary Key for the Dimension Table 4 Click OK to save your changes and close the properties window for the dimension table. You have now configured the metadata for the dimension table. The next step is to configure keys and change tracking for the SCD loader. Specify the Business Key for the SCD Loader The business key is the primary key of a source table that is used to load the dimension table. In this example, the business key would be the CUSTOMER_ID column in the CUSTOMER_TRANS table. Follow these steps to specify the business key for the SCD loader: 1 In the Process Designer window, double-click the icon for the SCD Type 2 Loader to display its properties window. 2 In the properties window, click the Business Key tab. Click New to display the column selection window. Using Slowly Changing Dimensions Specify the Generated Key for the SCD Loader 209 3 In the column selection window, select the CUSTOMER_ID column and click OK. The CUSTOMER_ID column displays as the business key on the Business Key tab, as shown in the following display. Display 12.8 Business Key Specified for the SCD Type 2 Loader 4 Click Apply to save your changes. The next step is to specify a generated key for the SCD loader. Specify the Generated Key for the SCD Loader Follow these steps to specify the generated key for the SCD loader: 1 In the properties window for the SCD Type 2 Loader, click the Generated Keys tab. . registered in a current metadata repository. You have selected a default SAS application server for SAS Data Integration Studio, as described in “Selecting a Default SAS Application Server” on. in earlier, and (b) the metadata for the table must be updated for the current job. Follow these steps to check out existing metadata: 1 On the SAS Data Integration Studio desktop, select the. metadata repository is under change-management control. For details about change management, see “Working with Change Management” on page 1 13. It is assumed that you have started SAS Data Integration

Ngày đăng: 05/07/2014, 11:20

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN