In this tutorial , learn how to design a batch job type allows the automatic generation of a dimension Time or Date using the component " Date_Generation " and then store the information in a table.
Prerequisites: Access to MS SQL type database SERVER 2012 or other,
The component " Date_Generation "
The structure of the target table " TIME_DIM "
Scripting the target structure " time_dim " found in the appendix.
Version: 4.2 SAP Data Services
Application: Data Services Designer
Create project
- Select Project > New Project .
- Enter the name of your new project .
The name can contain alphanumeric characters and underscores ( _). It can not contain spaces.
- Click Create
Create a job in project Area
- In the project , select the project name .
- Click the right mouse button and select New Batch Job or Job in real time.
- Change the name .
The name can contain alphanumeric characters and underscores ( _). It can not contain spaces.
The software opens a new workspace where you define the job
Create a WorkFlow
- In the project area , click the created job.
- Select the " Workflow " icon in the tool palette .
- Place the " workflow " in the job workspace
Create a DataFlow "DF_DIM_DATE"
- In the project area , click the created workflow.
- Select the data flow icon in the tool palette.
- Set the data flow in the workflow workspace.
Start creatingyourdata flow.
Double-clickthe icon of thedata Flow.
You cannowstart placingobjects in thedata flow diagram. Objects can besourcetypes, target and/or Transforms.
Definea data flow "DFDIM_TIME"
The data flowconsists of the followingcomponents:
- A "Date_Generation transform" component definedas the source.
- A transformation"Query" to generate the datafrom theclonnne"DI_GENERATED_DATE"
- An MSSQL SERVERtable thatreceivesthe generatedinformation.
Specify the componentsof the flow"DF_DIM_TIME"
- Openthe data flowentitled "DF_DIM_TIME"
- Select Inthe localobject library, click the "Transforms"
- The object "Date_Generation" is in "Data Integrator"
- Drag and dropthe icon "Date_Generation" in the workspaceof"dataflow" tab.
- Click the"query" availablein the paletteand place theright ofthe object "Date_Generation" icon
- Inthe local libraryof objectsinthe datastore"MSSQL_INSTANCE1", drag the table"TIME_DIM" and dropthesubjectto the right oftransformation"Query" like the following configuration:
Configure the component"DataGeneration"
Click the object"Date_Generation" in the workflowspaceto open thetransformationeditor
Enter the following informationin the DatetabGeneration
- Start date:2002.01.01
- End Date:20014.12.31
- Increment:Daily
Clickthe green arrowfound inthe toolbarto return tothe workspaceof"dataflow".
Configuring thetransformation"Query"
In the projectarea, clickon the icon "Query", you will see that we havea single column"DI_GENERATED_DATE" in "schemaIn" five pillarsconstituting theoutput flowand processingoptions.
- Map the"DI_GENERATED_DATE" column withthe target column"DATE NATIVE" draggingthe source objectinthe target object.
For mappingyou can proceedas follows: - Select"NATIVEDATE" column from"SchemaOut"
- Thendragthe object "DI_GENERATED_DATE" from "patterninput"and placeit inthe tab"Mapping" Use thetable belowto completethe mappingof the remainingcolumns
Column | Mapping |
---|---|
DATE_ID | Julian(DI_GENERATED_DATE) |
YEARNUM | to_char(DI_GENERATED_DATE,'yyyy') |
MONTHNUM | Month(DI_GENERATED_DATE) |
BUSQUARTER | Quarter(DI_GENERATED_DATE) |
- Clickthe green arrow toreturn tothe workspace.
- Save andrun the job
- Checkthe proper integration ofdata into the table"TIME_DIM" MSQLSERVERtarget.