You are on page 1of 7

Avoid Truncating W_DAY_D in incremental load

Issue Description:
W_DAY_D stores both Gregorian calendar and Enterprise Calendar attributes. Per current design, it is
truncated in every load to enable date range extension flexibility. If a user does not need to extend data
range, he does not need to have W_DAY_D to be truncated in every load.
This table is truncated at the beginning of an execution plan in each load, and the Gregorian calendar
attributes are then loaded immediately, while the enterprise calendar attributes from the previous run
are lost. The enterprise calendar attributes are loaded much later in the SIL phase after the fiscal
calendar and enterprise calendar related tables (i.e., W_MCA_%_D and W_ENT_%_D) are loaded. As a
result, in each run, there is a duration for which W_DAY_D is missing enterprise calendar attributes. The
length of the duration can be of hours. During the period, all dashboard reports that use these
enterprise calendar attributes wont run.
Therefore, the requirement is to NOT truncate W_DAY_D in incremental load.

Solution Assumption:
Users do not require change of date range (e.g., from 1970/01/01 to 2030/12/31) covered by W_DAY_D
after full load, in subsequent incremental loads. As long as there is not such date range change
requirement, we do not need to truncate W_DAY_D in incremental loads.

Solutions Summary:
The fix requires the following development in ODI:
1. We only load W_DAY_D once in full load. We turn off the task that loads it from subsequent incr
loads.
2. We set table maintenance of W_DAY_D to default so that it wont be truncated in incr load.
3. We keep updating W_CURRENT_CAL_%_DODE columns in each incr load. (This is done by a
separate ETL task, so there is no additional work.) Note that we must update these because
there are a lot of RPD variables that are refreshed using W_DAY_D. Incorrect
W_CURRENT_CAL_%_DODE values would fail RPD variables.
4. We update enterprise calendar attributes in SIL phase. However, since we do not truncate
W_DAY_D, it will hold original value before we update these attributes.

Special concern:
Since we are not truncating W_DAY_D in incremental load, to update enterprise calendar attributes, we
must first reset/wipe out the old value from the previous run, and then reload new values according to
the enterprise calendar used in the current run. This is because it is possible that the enterprise calendar
is changed from the previous load to the current load. The two enterprise calendars used can be
completely different and can have very distinct date range. In this case, we must wipe out old values
first. As a result, we must add a new main interface to conduct such effort.

Solution Details:
Step 1: Disable loading of W_DAY_D in incremental load
In the package SIL_DayDimension, add a Evaluate IS_INCREMENTAL step and set its condition to N. This
means that we will run the task to load W_DAY_D only in full load. Save the package and then
regenerate the scenario SILOS_SIL_DAYDIMENSION.

Step 2: Set table maintenance behavior of W_DAY_D to Default


Check the Default checkbox for OBI Table Maintenance Behavior:

Step 3: Create a new main interface to reset enterprise attributes before each update
In the task SIL_TimeDimension_UpdateEnterpriseAttributes, create a new main interface called
SIL_TimeDimension_UpdateEnterpriseAttributes.W_DAY_D_RESET_ENT_ATTRS:

Use W_DAY_D as its source and target:

The filter condition on source is:


W_DAY_D.ROW_WID <> 0

The target table property should be (make sure to set Update Key as <Undefined>):

Instead, we use ROW_WID as our update key. Make sure the target column ROW_WID has the following
properties:

Map enterprise calendar attributes as follows (leave other columns unmapped):


Column Name
ENT_PERIOD_AGO_WID
ROW_WID
ENT_DAY_OF_PERIOD
ENT_DAY_OF_WEEK
ENT_DAY_OF_YEAR
ENT_HALF
ENT_PERIOD
ENT_QTR
ENT_TRIMESTER
ENT_WEEK
ENT_YEAR
PER_NAME_ENT_HALF
PER_NAME_ENT_PERIOD
PER_NAME_ENT_QTR
PER_NAME_ENT_TER
PER_NAME_ENT_WEEK

Mapping Expression
0
W_DAY_D.ROW_WID
0
0
0
0
0
0
0
0
0
'__UNSPECIFIED__'
'__UNSPECIFIED__'
'__UNSPECIFIED__'
'__UNSPECIFIED__'
'__UNSPECIFIED__'

Execution DB
Staging Area
Source
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area

PER_NAME_ENT_YEAR
ENT_WEEK_START_DT
ENT_WEEK_END_DT
ENT_PERIOD_START_DT
ENT_PERIOD_END_DT
ENT_QTR_START_DT
ENT_QTR_END_DT
ENT_YEAR_START_DT
ENT_YEAR_END_DT
ENT_WEEK_START_DT_WID
ENT_WEEK_END_DT_WID
ENT_PERIOD_START_DT_WID
ENT_PERIOD_END_DT_WID
ENT_QTR_START_DT_WID
ENT_QTR_END_DT_WID
ENT_YEAR_START_DT_WID
ENT_YEAR_END_DT_WID
ENT_DIM_QTR_NUM
ENT_DIM_PERIOD_NUM
ENT_PERIOD_WEEK_NUM
ENT_DIM_WEEK_NUM
ENT_DIM_YEAR_NUM
W_CURRENT_ENT_WEEK_CODE
W_CURRENT_ENT_PERIOD_CODE
W_CURRENT_ENT_QTR_CODE
W_CURRENT_ENT_YEAR_CODE
FST_DAY_ENT_WEEK_FLG
LAST_DAY_ENT_WEEK_FLG
FST_DAY_ENT_PERIOD_FLG
LAST_DAY_ENT_PERIOD_FLG
FST_DAY_ENT_QTR_FLG
LAST_DAY_ENT_QTR_FLG
FST_DAY_ENT_YEAR_FLG
LAST_DAY_ENT_YEAR_FLG
ENT_PRIOR_YEAR_WID
ENT_PRIOR_WEEK_WID
ENT_PRIOR_PERIOD_WID
ENT_PRIOR_QTR_WID
ENT_QTR_AGO_WID
ENT_WEEK_AGO_WID

'__UNSPECIFIED__'
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
0
0
0
0
0
0
0
0
0
0
0
0
0
DOMAIN_DEFAULT_NOT_APPLICABLE(NULL)
DOMAIN_DEFAULT_NOT_APPLICABLE(NULL)
DOMAIN_DEFAULT_NOT_APPLICABLE(NULL)
DOMAIN_DEFAULT_NOT_APPLICABLE(NULL)
'N'
'N'
'N'
'N'
'N'
'N'
'N'
'N'
0
0
0
0
0
0

Under flow tab of the new main interface, set the following properties:

Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area
Staging Area

Save the main interface.


Next, add the new main interface to the package SIL_TimeDimension_UpdateEnterpriseAttributes, and
configure the package as follows:

Add an Evaluate IS_INCRMENTAL step and set its condition to Y.

Add the new main interface after the Evaluate IS_INCRMENTAL step with true condition.

Connect to the existing main interface step after the new step.

Connect the false branch of Evaluate IS_INCREMENTAL to the existing main interface step.

Refer to the screenshot below. This allows the new main interface to be run only in incremental load.

Save the package and regenerate the scenario


SILOS_SIL_TIMEDIMENSION_UPDATEENTERPRISEATTRIBUTES.

You might also like