Essential Functions for Data Manipulation
Essential Functions for Data Manipulation
1 Character Functions:
1.1 LENGTH:
1.2 LPAD:
1.3 LTRIM:
1.4 RPAD:
1.5 RTRIM:
1.6 SUBSTR:
2 Conversion Functions:
2.1 TO_CHAR:
2.2 TO_DATE:
2.3 TO_DECIMAL:
2.4 TO_FLOAT:
2.5 TO_INTEGER:
3 Date Functions:
3.1 ADD_TO_DATE
3.2 DATE_COMPARE
3.3 DATE_DIFF
3.4 GET_DATE_PART
3.5 LAST_DAY
3.6 MAX
3.7 MIN
3.8 ROUND
3.9 SET_DATE_PART
3.10 TRUNC
4 Special Functions:
4.1 DECODE
4.2 IIF
4.3 ERROR:
4.4 LOOKUP:
5 Test Functions:
5.1 ISNULL
5.2 IS_DATE
5.3 IS_NUMBER
5.4 IS_SPACES
1 Character Functions:
1.1 LENGTH:
The LENGTH function returns the number of characters in a string, including
trailing blanks. It is available in the Designer and the Workflow Manager.
LENGTH (string)
Example: The following expression returns the length of each customer name:
LENGTH (CUSTOMER_NAME)
CUSTOMER_NAME------------RETURN VALUE
Leonardo------------------------8
NULL ---------------------------NULL
Edwin Britto ---------------------12
1.2 LPAD:
The LPAD function adds a set of blanks or characters to the beginning of a string,
to set a string to a specified length. It is available in the Designer and the
Workflow Manager.
LPAD (first_string, length [, second_string])
1.3 LTRIM:
The LTRIM function removes blanks or characters from the beginning of a string.
It is available in the Designer and the Workflow Manager.
LTRIM (string [, trim_set])
LTRIM (string) removes the leading spaces or blanks from the string. When LTRIM
function is used with a trim set, which is optional, it removes the characters in the
trim set from the string.
Example: The following expression removes the leading zeroes in the port
ITEM_CODE.
LTRIM (ITEM_CODE,'0')
* The LTRIM function can be nested when needed to remove multiple characters.
1.4 RPAD:
The RPAD function converts a string to a specified length by adding blanks or
characters to the end of the string. It is available in the Designer and the
Workflow Manager.
RPAD( first_string, length [, second_string ] )
Example: The following expression returns the string with a length of 5 characters,
appending the string ':' to the end of each word:
RPAD (WORD, 5, ':’)
1.5 RTRIM:
The RTRIM function removes blanks or characters from the end of a string. It is
available in the Designer and the Workflow Manager.
RTRIM (string [, trim_set])
The RTRIM function can be combined with the LENGTH function if the trailing
blanks are to be ignored. It can also be nested when needed to remove multiple
characters.
RTRIM (string) removes the trailing spaces or blanks from the string. When RTRIM
function is used with a trimset, which is optional, it removes the characters in the
trimset from the string.
For example,
RTRIM (ITEM_CODE,'10')
The above expression removes the characters 10 in the port ITEM_CODE.
ITEM_CODE -----------------------------RETURN VALUE
0610 -------------------------------------06
380 ---------------------------------------38
In the second example the function removes the trailing zero since the RTRIM
compares the first character in the trimset with the last character of the string,
since it does not match it takes the second character in the trimset and compares
with last character of the string. Since it matches it removes it.
1.6 SUBSTR:
The SUBSTR function returns a portion of a string. It is available in the Designer
and the Workflow Manager.
SUBSTR( string, start [, length ] )
The SUBSTR may not give the desired result if the string on which it is used is not
trimmed. Though it is always a good practice to trim the strings before using them
in any expression, it becomes extremely important to trim them if they are used
in a SUBSTR function.
SUBSTR(LTRIM(NAME),2,2)
The SUBSTR function can also be used to get the last few characters as described
below.
SUBSTR(NAME,-3,3)
This function will return the last three characters of the string. But it may not
return the required last three characters if the port has trailing blanks, hence
RTRIM is essential.
SUBSTR(RTRIM(NAME),-3,3)
Hence it is always better to trim the strings before using them in a SUBSTR
function.
SUBSTR(LTRIM(RTRIM(NAME)),3,2)
The above expression will get the 3,4 character of the port NAME irrespective of
whether the port has leading or trailing blanks or not.
2 Conversion Functions:
2.1 TO_CHAR:
The TO_CHAR function converts numeric values and dates to text strings. It is
available in the Designer and the Workflow Manager.
TO_CHAR( numeric_value )
TO_CHAR (date [, format ] )
Example : The following expression converts the values in the SALES port to text:
TO_CHAR (SALES )
SALES --------------------RETURN VALUE
1800.03 ------------------'1800.03'
-22.57891 -----------------'-22.57891'
The following expression converts the dates in the DATE_PROMISED port to text
in the format MON DD YYYY:
TO_CHAR (DATE_PROMISED, 'MON DD YYYY' )
TO_CHAR(ADD_TO_DATE(TO_DATE(DATE_PROMISED),'DD',1),'YYYYMMDD')
2.2 TO_DATE:
The TO_DATE function converts a character string to a date datatype in the same
format as the character string. It is available in the Designer and the Workflow
Manager.
TO_DATE( string [, format ] )
Example : The following expression returns date values for the strings in the
DATE_PROMISED port. TO_DATE always returns a date and time. If we pass a
string that does not have a time value, the date returned always includes the time
00:00:00. If we execute a session in the twentieth century, the century will be 19.
The current year on the machine running the Informatica Server is 1998:
The format of the string must exactly be the format given in the TO_DATE
function.
* TO_DATE function fails if invalid date entries are given. To avoid this we must
use IS_DATE function to check if the string has a valid date to be converted.
2.3 TO_DECIMAL:
The TO_DECIMAL function converts any value (except binary) to a decimal. It is
available in the Designer.
TO_DECIMAL( value [, scale ] )
Example : This expression uses values from the port IN_TAX. The datatype is
decimal with precision of 10 and scale of 3:
TO_DECIMAL( IN_TAX, 3 )
IN_TAX ------------------------RETURN VALUE
'15.6789' ------------------------15.678
NULL ---------------------------NULL
'A12.3Grove'-------------------- 0
2.4 TO_FLOAT:
The TO_FLOAT function converts any value (except binary) to a double-precision
floating point number (the Double datatype). It is available in the Designer and
the Workflow Manager.
TO_FLOAT( value )
2.5 TO_INTEGER:
The TO_INTEGER function converts any value (except binary) to an integer by
rounding the decimal portion of a value. It is available in the Designer and the
Workflow Manager.
TO_INTEGER( value )
3 Date Functions:
Days (01-31). We can use any of these format strings to specify the entire day
portion of a date. For example, if we pass 12-APR-1997 to a date function, we can
use any of these format strings specify 12.
MI
Minutes.
3.1 ADD_TO_DATE
The ADD_TO_DATE function adds a specified amount to one part of a date/time
value, and returns a date in the same format as the specified date.
Note: If we do not specify the year as YYYY, the Informatica Server assumes the
date is in the current century. It is available in the Designer and the Workflow
Manager.
ADD_TO_DATE( date, format, amount )
Example : The following expression adds one month to each date in the
DATE_SHIPPED port. If we pass a value that creates a day that does not exist in a
particular month, the Informatica Server returns the last day of the month. For
example, if we add one month to Jan 31 1998, the Informatica Server returns Feb
28 1998.
Also note, ADD_TO_DATE recognizes leap years and adds one month to Jan 29
2000:
ADD_TO_DATE( DATE_SHIPPED, 'MM', 1 )
The following expression subtracts 10 days from each date in the DATE_SHIPPED
port:
ADD_TO_DATE( DATE_SHIPPED, 'D', -10 )
DATE_SHIPPED --------------RETURN VALUE
Jan 1 1997 12:00:30AM -------Dec 22 1996 12:00AM
The following expression subtracts 15 hours from each date in the DATE_SHIPPED
port:
ADD_TO_DATE( DATE_SHIPPED, 'HH', -15 )
3.2 DATE_COMPARE
The DATE_COMPARE function returns a value indicating the earlier of two dates.
It is available in the Designer and the Workflow Manager.
DATE_COMPARE( date1, date2 )
3.3 DATE_DIFF
The DATE_DIFF function returns the length of time between two dates, measured
in the specified increment (years, months, days, hours, minutes, or seconds). It is
available in the Designer and the Workflow Manager.
DATE_DIFF( date1, date2, format )
Example: The following expressions return the number of days between the
DATE_PROMISED and the DATE_SHIPPED ports:
DATE_DIFF DATE_DIFF ( DATE_PROMISED, DATE_SHIPPED, 'D' )
DATE_DIFF DATE_DIFF ( DATE_PROMISED, DATE_SHIPPED, 'DD' )
We can combine DATE functions and TEST functions so as to validate the dates.
For example, while using the DATE functions like DATE_COMPARE and
DATE_DIFF, the dates given as inputs can be validated using the TEST function
IS_DATE and then passed to them if valid.
3.4 GET_DATE_PART
The GET_DATE_PART function returns the specified part of a date as an integer
value, based on the default date format of MM/DD/YYYY HH24:MI:SS. It is
available in the Designer and the Workflow Manager.
GET_DATE_PART( date, format )
Example: The following expressions return the day for each date in the
DATE_SHIPPED port:
GE GET_DATE_PART ( DATE_SHIPPED, 'D' )
GEGET_DATE_PART ( DATE_SHIPPED, 'DD' )
3.5 LAST_DAY
The LAST_DAY function returns the date of the last day of the month for each
date in a port. It is available in the Designer and the Workflow Manager.
LAST_DAY( date )
Example : The following expression returns the last day of the month for each
date in the ORDER_DATE port:
LAST_DAY( ORDER_DATE )
3.6 MAX
The MAX function returns the latest date found in a group. It is available in the
Designer.
MAX( date, filter_condition )
We can return the maximum date for a port or group.
Example: The following expression returns the maximum order date for
flashlights:
MAX( ORDERDATE, ITEM_NAME='Flashlight' )
ITEM_NAME -----------ORDER_DATE
Flashlight ---------------Apr 20 1998
Regulator ---------------System May 15 1998
Flashlight ---------------Sep 21 1998
Diving Hood ------------Aug 18 1998
Halogen Flashlight ------Feb 1 1998
Flashlight ---------------Oct 10 1998
3.7 MIN
The MIN function returns the earliest date found in a group. It is available in the
Designer.
MIN( date, filter_condition )
Example: The following expression returns the oldest order date for flashlights:
MIN( ORDER_DATE, ITEM_NAME='Flashlight' )
ITEM_NAME --------------ORDER_DATE
Flashlight -------------------Apr 20 1998
Regulator System -----------May 15 1998
Flashlight -------------------Sep 21 1998
Diving Hood ----------------Aug 18 1998
Halogen Flashlight ----------Feb 1 1998
Flashlight -------------------Oct 10 1998
RETURN VALUE: ----------Feb 1 1998
3.8 ROUND
The ROUND function rounds one part of a date. It is available in the Designer and
the Workflow Manager.
ROUND( date [, format ] )
Example: The following expressions round the month portion of each date in the
DATE_SHIPPED port.
ROUND( DATE_SHIPPED, 'MM' )
ROUND( DATE_SHIPPED, 'MON' )
Similarly the ROUND function can be used to round off Year, Day or Time
portions.
3.9 SET_DATE_PART
The SET_DATE_PART function sets one part of a date/time value to a specified
value. It is available in the Designer and the Workflow Manager.
SET_DATE_PART( date, format, value )
Example: The following expressions change the month to June for the dates in the
DATE_PROMISED port. The Informatica Server displays an error when we try to
create a date that does not exist, such as changing March 31 to June 31:
SET_DATE_PART( DATE_PROMISED, 'MM', 6 )
SET_DATE_PART( DATE_PROMISED, 'MON', 6 )
Similarly the SET_DATE_PART function can be used to round off Year, Day or Time
portions.
3.10 TRUNC
The TRUNC function truncates dates to a specific year, month, day, hour, or
minute. It is available in the Designer and the Workflow Manager.
TRUNC( date [, format ] )
Example: The following expressions truncate the year portion of dates in the
DATE_SHIPPED port:
TRUNC( DATE_SHIPPED, 'Y' )
TRUNC( DATE_SHIPPED, 'YY' )
Similarly the TRUNC function can be used to truncate Month , Day or Time
portions.
The functions TRUNC & ROUND can be nested in order to manipulate dates.
4 Special Functions:
4.1 DECODE
The DECODE function searches a port for the specified value. It is available in the
Designer and the Workflow Manager.
DECODE( value, first_search, first_result [, second_search, second_result ]…[,
default ] )
4.2 IIF
The IIF function returns one of two values we specify, based on the results of a
condition. It is available in the Designer and the Workflow Manager.
4.3 ERROR:
The ERROR function causes the Informatica Server to skip a record and throws an
error message defined by the user. It is available in the Designer.
ERROR( string )
Example : The following example shows how you can reference a mapping that
calculates the average salary for employees in all departments of your company,
but skips negative values. The following expression nests the ERROR function in
an IIF expression so that if the Informatica Server finds a negative salary in the
Salary port, it skips the row and displays an error:
The below example combines two special functions, a test Function and a
conversion function.
IIF(IS_DATE(DATE_PROMISED,'MM/DD/YY'),TO_DATE(DATE_PROMISED),ERROR('I
nvalid Date'))
4.4 LOOKUP:
The LOOKUP function searches for a particular value in a lookup source column. It
is available in the Designer.
5Test Functions:
5.1 ISNULL The ISNULL function returns whether a value is NULL. It is available in
the Designer and the Workflow Manager.
ISNULL( value )
Example : The following example checks for null values in the items table:
Flashlight------------------- 0 (FALSE)
5.2 IS_DATE
The IS_DATE function returns whether a value is a valid date. It is available in the
Designer and the Workflow Manager. IS_DATE( value ) Example : The following
expression checks the INVOICE_DATE port for valid dates:
IS_DATE( INVOICE_DATE )
This expression returns data similar to the following:
NULL ------------------------------NULL
This function can also be used to validate a date for a specified format for which
the syntax is
IS_NUMBER( value )
Example : The following expression checks the ITEM_PRICE port for valid
numbers: IS_NUMBER( ITEM_PRICE )
-ABC-------------------------- 0 (False)
NULL -------------------------NULL
5.4 IS_SPACES
IS_SPACES( value )
Example : The following expression checks the ITEM_NAME port for rows that
consist entirely of spaces:
Flashlight--------------------------- 0 (False)
-------------------------- 1 (True)
===================================
Conversion Functions:
TO_CHAR: TO_CHAR (SALES )
TO_CHAR (DATE_PROMISED, 'MON DD YYYY' )
TO_DATE: DATE( DATE_PROMISED, 'MM/DD/YY' )
TO_DECIMAL: TO_DECIMAL( value [, scale ] )
TO_FLOAT: TO_FLOAT( value )
TO_INTEGER: TO_INTEGER( IN_TAX )
Date Functions:
ADD_TO_DATE: ADD_TO_DATE( DATE_SHIPPED, 'MM', 1 )
DATE_COMPARE: DATE_COMPARE ( DATE_PROMISED, DATE_SHIPPED )
DATE_DIFF: DATE_DIFF ( DATE_PROMISED, DATE_SHIPPED, 'D' )
GET_DATE_PART: GET_DATE_PART( date, format )
LAST_DAY :LAST_DAY( ORDER_DATE )
MAX :MAX( ORDERDATE, ITEM_NAME='Flashlight' )
MIN: MIN( ORDER_DATE, ITEM_NAME='Flashlight' )
ROUND: ROUND( DATE_SHIPPED, 'MM' )
SET_DATE_PART :SET_DATE_PART( DATE_PROMISED, 'MM', 6 )
TRUNC :TRUNC( date [, format ] )
Special Functions
DECODE function searches a port for the specified value. It is available in the
Designer and the Workflow Manager.
The IIF function returns one of two values we specify, based on the results of a
condition. It is available in the Designer and the Workflow Manager.
The ERROR function causes the Informatica Server to skip a record and throws an
error message defined by the user. It is available in the Designer.
The LOOKUP function searches for a particular value in a lookup source column. It
is available in the Designer.
Test Functions
ISNULL
IS_SPACES
COUNT
Table - SELECT COUNT (*) FROM tablename
Specific Column - SELECT COUNT(ColumnName)FROM tablename
Group Column - SELECT ColumnName, COUNT (*) FROM tablename GROUP BY
ColumnName
DISTINCT
SELECT DISTINCT ColumnName FROM tablename
Copy Table
Oracle - CREATE TABLE New_tablename AS SELECT * FROM Old_tablename
Teradata - CREATE TABLE Old_tablename AS New_tablename WITH DATA;
Delete Table
Oracle - DELETE FROM tablename
Teradata - DELETE TABLE tablename
Dummy Table
Oracle - SELECT 5*7 FROM DUAL
Teradata - SELECT 5*7 FROM tablename (Use existing any table name)
HAVING
SELECT
CITY_NAME, COUNT (CUST_ID) AS TOTALCUSTOMER
FROM CUSTOMER_TABLE
WHERE CITY_NAME LIKE 'N%'
GROUP BY CITY_NAME
HAVING COUNT (CUST_ID) <=3
ORDER BY COUNT (CUST_ID)
INSERT
INSERT INTO SAMPLES.EMPLOYEE_PAY_TBL
(EmpName, EmpNo, DeptNo, Sex, DOB)
VALUES ('John Smith', 10001, NULL, 'M', 560231)
UPDATE
UPDATE ORDERS_TBL
SET QTY = 1,
CUST_ID = ‘221’
WHERE ORD_NUM = ‘23A16’;
Delete Rows
DELETE FROM ORDERS_TBL
WHERE ORD_NUM ='23A16'
ALTER
ALTER TABLE EMPLOYEE_TBL MODIFY
EMP_ID VARCHAR(10)
SELECT * FROM TD_ORDERS WHERE EMPLOYEEID BETWEEN '4' AND ' 5'
Subqueries
man - manual pages - Ex: man ls (displays the help for the command ls)
cp - copy a file
cp -i (prompt in case you are overwriting a file)
cp -r (recursive copy for directories)
rm - remove a file
rm -i (prompt before deletion)
rm -r (remove files recursively)
wc - word count
wc -l (line count)
wc -w (word count)
wc -c (character count)
du - disk usage.
cpio - copy file archives Ex: cpio -icBdvmu < /dev/rmt0 45. tar - tape archives Ex:
tar xvt /dev/rmt0
pstat -s reports system swap area (BSD) swap -l reports system swap area (AT&T)
tail - 100
Directory
Files
Search
Find
find . -name "*.txt" -print Search for all files with the extention .txt, starting at
the current directory (.)
find . -size +1M -ls find files over 1Mb in size, and display the result as a long
listing
history show command history list
Access rights
gzip
gzip [Link] compress the file and place it in a file called [Link]
gunzip [Link] To expand the file, use the gunzip command
zcat
Jobs
Print
lpr file Use the -P option to specify the printer name (other than default printer)
lpq check out the printer queue
lprm jobnumber Remove something from the printer queue.
General
Help
VI Editor
Unix Vi Editor
vi filename - Open a file When you start up vi, you are in "command mode." -
Default mode
Screen Manipulation
Searching Text
:r filename read file named filename and insert after current line (the line with
cursor)
:w write current contents to file named in original vi call
:w newfile write current contents to a new file named newfile
:12,35w smallfile write the contents of the lines numbered 12 through 35 to a
new file named smallfile
:w! prevfile write current contents over a pre-existing file named prevfile
Shell Scripting
Variables
$ x="hello"
$ y=`expr $x + 1`
expr: non-numeric argument
$
#!/bin/sh
echo What is your name?
read MY_NAME
echo "Hello $MY_NAME - hope you're well."
[Link]
#!/bin/sh
echo "What is your name?"
read USER_NAME
echo "Hello $USER_NAME"
echo "I will create you a file called ${USER_NAME}_file"
touch "${USER_NAME}_file"
If you want to add some character after the variable use curly brackets
Wildcards
Think first how you would copy all the files from /tmp/a into /tmp/b. All the .txt
files? All the .html files?
$ cp /tmp/a/* /tmp/b/
$ cp /tmp/a/*.txt /tmp/b/
$ cp /tmp/a/*.html /tmp/b/
Loops
For
[Link]
#!/bin/sh
for i in 1 2 3 4 5
do
echo "Looping ... number $i"
done
While Loops
#!/bin/sh
INPUT_STRING=hello
while [ "$INPUT_STRING" != "bye" ]
do
echo "Please type something in (bye to quit)"
read INPUT_STRING
echo "You typed: $INPUT_STRING"
done
#!/bin/sh
The colon (:) always evaluates to true
while :
do
echo "Please type something in (^C to quit)"
read INPUT_STRING
echo "You typed: $INPUT_STRING"
done
If
How do you find out the current directory you are in?
pwd
How do you stop all the processes, except the shell window?
kill 0 (Zero)
How do you search for a string in a directory with the subdirectories recursed?
grep -r string *
How do you find out the number of arguments passed to the shell script?
$#
Unions
Unions
Unions are used to retrieve records from multiple tables or to get multiple record
sets from a single table.
select cust_id, age
from financial.customer_name
UNION
select cust_id, age
from [Link] - we can add more union ( Same columns name to be
selected )
Unions Rules• Each query must return the same number of columns.
• The columns must be in the same order.
• Column datatypes must be compatible.
• In Oracle, you can only ORDER BY columns that have the same name in every
SELECT clause in the UNION.
UNION ALL
select
customer_name.cust_id,customer_name.age, 'young'
from financial.customer_name
Where customer_name.age < 30
UNION ALL is used instead of just UNION because no duplicates need to be
removed
Functions
SQL Overview
SQL tuning –
The objective is to reduce the operational overhead of executing the query on the
database.
The base table is the main table that most or all tables are joined to in a query.
The column from the base table is normally placed on the right side of a join
operation in the WHERE clause. The tables being joined to the base table are
normally in order from smallest to largest, similar to the tables listed in the FROM
clause.
SQL Join
Inner join Return records that match in both Table A and Table B
SELECT
EMPLOYEE_TBL.EMP_ID,
EMPLOYEE_TBL.LAST_NAME,
EMPLOYEE_PAY_TBL.SALARY
FROM EMPLOYEE_TBL, EMPLOYEE_PAY_TBL
WHERE EMPLOYEE_TBL.EMP_ID = EMPLOYEE_PAY_TBL.EMP_ID
SELECT
CUSTOMER_NAME.CUST_ID,
CUSTOMER_NAME.INCOME,
[Link]
FROM CUSTOMER_NAME
JOIN CUSTOMER
ON ( CUSTOMER_NAME.CUST_ID = CUSTOMER.CUST_ID)
WHERE [Link] > 30"
Full outer join Return all records in Table A and Table B, with matching records
from both sides where available. If there is no match, the missing side will contain
null.
Left outer join Return all records from Table A, with the matching records (where
available) in Table B. If there is no match, the right side will contain null.
SELECT
CUSTOMER_NAME.CUST_ID,
CUSTOMER_NAME.AGE,
CUSTOMER_NAME.INCOME,
[Link],
CUSTOMER.CUST_ID
FROM [Link]
LEFT JOIN CUSTOMER_NAME ON
( CUSTOMER_NAME.CUST_ID = CUSTOMER.CUST_ID)
Self Joins is used to join a table to itself, as if the table were two tables,
temporarily renaming at least one table in the SQL statement using a table alias.
Using Table Alias - The use of table aliases means to rename a table in a particular
SQL statement.
Multi Table joins – Connect table one by one table 1 = table 2 and table 2 = table
3
SELECT
ACCTS.ACCT_END_DATE,CHECKING_ACCT.ACCOUNT_ACTIVE,CHECKING_TRAN.AC
CT_NBR
FROM ACCTS
JOIN CHECKING_ACCT ON (ACCTS.CUST_ID = CHECKING_ACCT.CUST_ID)
JOIN CHECKING_TRAN ON (CHECKING_ACCT.ACCT_NBR =
CHECKING_TRAN.ACCT_NBR)
WHERE FINANCIAL.CHECKING_ACCT.ACCOUNT_ACTIVE = 'Y'
Transformation Notes
Informatica Transformation
Source qualifier: - Read data from flat file and relational source. It has capability
to override this default query by changing the default settings.
We can handle this update Strategy in Session level also Within a session. Session
– Mapping - Target – Select
Normal Join: With a Normal join, the Informatica Server discards all rows of data
from the master and detail source that do not match, based on the condition.
Master Outer Join: A Master Outer Join keeps all rows of data from the detail
source and the matching rows from the master source. It discards the unmatched
rows from the master source.
Detail Outer Join: A Detail Outer Join keeps all rows of data from the master
source and the matching rows from the detail source. It discards the unmatched
rows from the detail source.
Full Outer Join: A Full Outer Join keeps all rows of data from both the master and
detail sources.
External Procedure - Call compiled code for each row. External procedure is
calling a component...externally, and stored procedure is called from the
transformation. It is set of sql statements.
Connected / Unconnected
Part of Mapping Data Flow / Separate from the mapping data flow
Return multiple Values / Return one value
Receive input value directly Receive input value / from the pipeline. from the
result of a:LKP expression in another transformation
Unconnected lookup should be used when we need to call same lookup multiple
times in one mapping. For example, in a parent child relationship you need to
pass multiple child ids’s to get respective parent id's.
If u need to calculate a value for all the rows or for the maximum rows coming out
of the source then go for a connected lookup, Or, if it is not so then go for
unconnected lookup
1) Source Qualifier
2) Expression;
3) Lookup ( It send Null Value if there is no value;
4) Sequence Generator;
5) External Stored Procedure
6) Advanced External Stored Procedure.
Ports- Input, Output, Variable, Return/Rank, Lookup and Master? Variable ports
are used to store intermediate results. Variable ports can reference input ports
and variable ports, but not output ports.
Cache
Informatica Cache
Cache -Cache is stored in the cache directory Informatica server. For Aggregator,
Joiner and Lookup transformations cache Values are stored in the cache directory.
For sorter transformation cache values stored in the temp Directory.
Dynamic lookup cache - can be used when the target table is also the lookup
table. When a dynamic cache is used, the Informatica Server updates the lookup
cache as it passes rows to the target.
Persistent cache - If the cache files need to be saved and reused, it can be used
when the lookup table does not change between session runs.
Suppose we have a lookup table with same lookup condition and return/output
ports and the lookup table is used many times in multiple mappings. Let us say a
Customer Dimension table is used in many mappings to populate the surrogate
key in the fact tables based on their source system keys. Now if we cache the
same Customer Dimension table multiple times in multiple mappings that would
definitely affect the SLA loading timeline.
In the first mapping we will create the Named Persistent Cache file by setting
three properties in the Properties tab of Lookup transformation.
Re-cache from lookup source: To be checked i.e. the Named Persistent Cache file
will be rebuilt or refreshed with the current data of the lookup table.
Next in all the mappings where we want to use the same already built Named
Persistent Cache we need to set two properties in the Properties tab of Lookup
transformation
Data Profiling
Data profiling is the process of analyzing the source data and identifying the data
type, unique values, distinct values etc. Profiling is basically the search for pattern
in the data.
To take an example you might have a column called country name which is
coming from one source system. Before you populate it in your data warehouse
you want to identify the values in the column and standardize the values. For this
you might do data profiling. By data profiling you might find out, say US, is
represented as United States, USA, U.S.A. in your source data. Then you might
write rules to convert all the values to the desired value.
• Column profiling analyzes all the values within each column or attribute and
discovers metadata and content quality problems
Data Quality
Informatica Data Quality provides robust data analysis, data cleansing, data
matching, exception handling, and reporting and monitoring capabilities so that
data quality can be managed as an enterprise-wide initiative.
Defining data quality dimensions, building data quality scorecards, collecting data
quality business rules, reviewing data quality results, and managing exceptions.
To solve common name and address data problems, Informatica Data Quality
provides address cleansing and identity matching rules, which reduce project risk
and make the product quick and easy to use.
Data scrubbing - Process of filtering, merging, decoding and translating the source
data to create the validation data for data warehouse.
Differences Version
6 to 7
union transformation
lookup on flat files
can connect workflow through designer itself
7 to 8
java transformation
sql transformation
HTML transformation
8 versions contains integration services
Web based administration
User defined functions
7x is client server architecture
8x is Server based architecture
Single console to administer power center
The Repository Service and Integration Service (as replacement for Rep Server
and Informatica Server) can be run on different computers in a network (so called
nodes), even redundantly.
It has a support for unstructured data which includes spreadsheets, email,
Microsoft Word files, presentations and .PDF documents. It provides high
availability, seamless fail over, eliminating single points of failure.
It has added performance improvements (To bump up systems performance,
Informatica has added "push down optimization" which moves data
transformation processing to the native relational database I/O engine whenever
its is most appropriate.)
PowerCenter 8 release has "Append to Target file" feature.
DTM
After the load manager performs validations for the session, it creates the DTM
process. The DTM process is the second process associated with the session run.
The primary purpose of the DTM process is to create and manage threads that
carry out the session tasks.
When the PowerCenter Server runs a session, the DTM performs the following
tasks:
4. Validates session code pages if data code page validation is enabled. Check
query conversions if data code page validation is disabled.
The DTM allocates buffer memory to the session based on the DTM Buffer Size
setting in the session properties.
By default, the Integration Service determines the DTM buffer size at run time.
The Workflow Manager allocates a minimum of 12 MB for DTM buffer memory.
You can specify auto or a numeric value. If you enter 2000, the Integration Service
interprets the number as 2000 bytes. Append KB, MB, or GB to the value to
specify other units. For example, you can specify 512MB.
Errror handling
Data Error -Capture bad data into the error table’s then analysis remove the bad
data and reload.
Process Error -To handle Process errors we can configure an email task to notify
the event of a session failure.
Error on 0 in session properties, log 3 session logs, send alarm point – email to
prod support
Column indicator:
D -valid
o - overflow
n - null
t - truncate
When the data is with nulls or overflow it will be rejected to write the data to the
target
The reject data is stored on
Incremental Aggregation
Incremental Aggregation
Load Manager
Informatica Load Manager
While running a Workflow, the PowerCenter Server uses the Load Manager
process and the Data Transformation Manager Process (DTM) to run the
workflow and carry out workflow tasks.
When the PowerCenter Server runs a workflow, the Load Manager performs the
following tasks
Mapplet
Informatica Mapplet
Mapplet is a reusable object that is created using mapplet designer. The mapplet
contains set of transformations and it allows us to reuse that transformation logic
in multiple mappings.
Reusable transformation
For define the value you can give the initial value or you can create mapping
parameter file. But in the file you should specify the folder name. Session name.
Ex: [[Link]] $$parameter1=1; Otherwise Informatica server
cannot recognize the session.
Start value = Current value ( when the session starts the execution of the
undelying mapping)
Start value <> Current value ( while the session is in progress and the variable
value changes in one ore more occasions)
Current value at the end of the session is nothing but the start value for the
subsequent run of the same session.
Local Variables: You can use local that you create within a mapping in any
transformation expression.
System variable: $$$Sess Start Time these are constant throughout the mapping
and cannot be changed.
Parameter File
Parameter file is any text file where u can define a value for the parameter
defined in the Informatica session. This parameter file can be referenced in the
session properties When the informatica sessions run the values for the
parameter is fetched from the specified file. For eg : $$ABC
For UNIX shell users, enclose the parameter file name in single quotes:
-paramfile '$PMRootDir/[Link]'
For Windows command prompt users, the parameter file name cannot have
beginning or trailing spaces. If the name includes spaces, enclose the file name in
double quotes:
-paramfile ?$PMRootDirmy [Link]
Note: When you write a pmcmd command that includes a parameter file located
on another machine, use the backslash () with the dollar sign ($). This ensures
that the machine where the variable is defined expands the server variable.
Note File Syntex : [ Folder Name .WF:Work Flow Name. ST:Session Name]
Two $ sign for user create variables – Mapping -> Parameter and Variable
Pmcmd
Informatica Pmcmd
2) Recovery sessions
5) Schedule the sessions by using operating system schedule tools like CRON
Pmrep
pmrep command is used to connect to a repository and run PowerCenter
commands.
The basic difference of pmcmd and pmrep are, pmcmd used for running
workflows, creating loops in running workflows, mapping related stuffs, stopping
workflows and many more.
pmrep is basically program repository used for repository management e.g. taking
backup of repository, connecting to repository, creating folders, export
cmappings/sessions/workflows into xml, importing the same etc.
Repository
Informatica Repository
The place where you store the metadata is called repository. Repository is a
relational database that stores metadata, used by the Informatica Server.
Informatica Metadata contains all the information about the source tables target
tables the transformations to perform transformations during the ETL process.
Versioned Repository: This can either be local or global repository but it allows
version control for the repository. A versioned repository can store multiple
copies, or versions of an object. This features allows to efficiently develop, test
and deploy metadata in the production environment.
Repository is a relational database. You can view all metadata information in the
database Views. This is called MX Views
Tables Like
REP_ALL_MAPPINGS
REP_ALL_MAPPLETS
REP_ALL_TRANSFORMS
union
select distinct temp4.repository_name, temp2.subject_area,
temp3.mapping_name, temp2.source_name, temp2.source_field_name, null as
target_name, null as target_field_name
from (
select distinct temp1a.mapping_id ,temp1a.widget_id, temp1a.from_field_id
from (
select rep_widget_dep.from_instance_id, rep_widget_dep.from_field_id,
rep_widget_dep.to_instance_id, rep_widget_dep.to_field_id,
rep_widget_inst.mapping_id, rep_widget_inst.widget_id
from rep_widget_inst inner join rep_widget_dep on
(rep_widget_inst.mapping_id=
rep_widget_dep.mapping_id and rep_widget_inst.instance_id=
rep_widget_dep.from_instance_id)
where rep_widget_inst.widget_type=1
) temp1a,
(
select distinct rep_widget_dep.from_instance_id, rep_widget_dep.from_field_id
from rep_widget_inst inner join rep_widget_dep on
(rep_widget_inst.mapping_id=
rep_widget_dep.mapping_id and rep_widget_inst.instance_id=
rep_widget_dep.from_instance_id)
where rep_widget_inst.widget_type=3
) temp1b
where temp1a.to_instance_id=temp1b.from_instance_id
and temp1a.to_field_id=temp1b.from_field_id
) temp1
Version
Informatica Version
Version control means, if you want to modify the mapping, we can use this
concept and in this the version numbers are like 1,2 etc, but not like 1.1, 1.2. in
this we have this following function like check in, check out, undo check out, view
history, delete, recovery, purge.
Workflow Manager
Workflow tasks
Worklets
Informatica Notes
Informatica Notes
Test Plan and Validation – In Informatica we create some test SQL to compare
the number or records and validate scripts if the data in the warehouse is loaded
for the logic incorporated.
Cached lookup - For a cached lookup the entire rows (lookup table) will be put in
the buffer, and compare these rows with the incomming rows.
Uncached lookup - for every input row the lookup will query the lookup table and
get the rows.
Can we create index and drop index in existing table while using informatica
4 ways in INFORMATICA
1) Source Analyzer window- (source table, Using key ports (enable, disable)).
2) Source qualifier Trans- (Sql override)
3) Target override
4) Pre sql, Post sql
What is the method of loading 5 flat files of having same structure to a single
target and which transformations I can use?
1. Write all file paths of five files in one file and use this file in session properties
as indirect.
2. Union Transformation
SCD
[Link]-type1:-it maintains current(updated) data.
[Link]-type2:-it maintains historical data.
[Link]-type3:-it maintains present n previous(partial history) data.
When we create a target as flat file and source as oracle.. how can i specify first
rows as column names in flat files...
use a pre sql statement....but this is a hardcoding method...if you change the
column names or put in extra columns in the flat file, you will have to change the
insert statement
You can also achive this by changing the setting in the Informatica Repository
manager to display the columns heading. The only disadvantage of this is that it
will be applied on all the files that will be generated by This server
For XML and file sources,informatica server reads multiple files [Link]
loading the data informatica server creates a seperate file for each partition(of a
source file).U can choose to merge the targets.
Informatica server can achieve high performance by partitioning the pipleline and
performing the extract , transformation, and load for each partition in parallel.
We can use the following Mapping for slowly Changing dimension table.
? Expression
? Lookup
? Filter
? Sequence Generator
? Update Strategy
Delta Load is the process to load only changes in the source table(s) to the
Warehouse database,ie new, changed (& deleted) rows.
Transformation Connected
Lookup Tips
1) If lookups contain a good deal of data (meaning that it would take far too long
to cache and/or will not fit in memory), moving the fields to the source qualifier,
and joining with the main table should be considered. The ONLY exception to this
should be if when much data is not processed through the lookup. In such a case
using an uncached lookup may be considered.
2) If the cache files need to be saved and reused, the transformation can be
configured to use a persistent cache. A persistent cache can be used when the
lookup table does not change between session runs. The first time the
Informatica Server runs a session using a persistent lookup cache, it saves the
cache files to disk instead of deleting them. The next time the Informatica Server
runs the session, it builds the memory cache from the cache files. If the lookup
table changes occasionally, the session properties need to be overridden to re-
cache the lookup from the database.
3) Speaking of initial loading overhead, all data read into a cache is read in by the
order of the fields listed in the lookup ports. If there is an index that is even
partially in this order, the loading of these lookups can be sped up substantially if
there is a large amount of data. Also, as many fields as are used in the mapping
need to be kept. Deleting unused columns can save a substantial amount of time.
4) If a lookup is used several times in a mapping, and has not been changed, it
will, by default, keep the cache built earlier for subsequent loads in the mapping.
If this feature is not needed (for example, the first transform may have updated
the data, and now the second uses it in a lookup), ‘Recache from Database’ option
needs to be checked.
5) Dynamic lookup cache can be used when the target table is also the lookup
table. When a dynamic cache is used, the Informatica Server updates the lookup
cache as it passes rows to the target. The Informatica Server builds the cache
when it processes the first lookup request. It queries the cache based on the
lookup condition for each row that passes into the transformation. When the
Informatica Server reads a row from the source, it updates the lookup cache by
either Inserting the row into the cache or by Updating the row in the cache or by
Making no change to the cache.
6) If the lookup table is on the same database as the source table in the mapping
and there is a lot of data which is not feasible to cache, the tables can be joined in
the source database rather than using a Lookup transformation.
7) The Informatica Server generates an ORDER BY statement for a cached lookup
by default that contains all lookup ports. To increase performance, the default
ORDER BY statement can be suppressed and an override ORDER BY with fewer
columns can be written.
8) If a Lookup transformation specifies several conditions, the lookup
performance can be improved by placing all the conditions that use the equality
operator first in the list of conditions that appear under the Condition tab.
Transformation Unconnected
Tips
1 Tips In Informatica
1.1 LOOKUP TIPS
1.2 JOINER TIPS
1.3 FILTER TIPS
1.4 AGGREGATOR TIPS
1.5 SORTER TIPS
1.6 UPDATE STRATEGY TIPS
1.7 SEQUENCE GENERATOR TIPS
1.8 STORED PROCEDURE TIPS
1.9 SHORTCUT TIPS
1.10 MAPPLET TIPS
1.11 ROUTER TIPS
1.12 GENERIC TIPS
2 Transformations In Informatica
2.1 TRANSACTION CONTROL TRANSFORMATION
2.2 STORED PROCEDURE TRANSFORMATION
2.3 RANK TRANSFORMATION
1) If lookups contain a good deal of data (meaning that it would take far too long
to cache and/or will not fit in memory), moving the fields to the source qualifier,
and joining with the main table should be considered. The ONLY exception to this
should be if when much data is not processed through the lookup. In such a case
using an uncached lookup may be considered.
2) If the cache files need to be saved and reused, the transformation can be
configured to use a persistent cache. A persistent cache can be used when the
lookup table does not change between session runs. The first time the
Informatica Server runs a session using a persistent lookup cache, it saves the
cache files to disk instead of deleting them. The next time the Informatica Server
runs the session, it builds the memory cache from the cache files. If the lookup
table changes occasionally, the session properties need to be overridden to re-
cache the lookup from the database.
3) Speaking of initial loading overhead, all data read into a cache is read in by the
order of the fields listed in the lookup ports. If there is an index that is even
partially in this order, the loading of these lookups can be sped up substantially if
there is a large amount of data. Also, as many fields as are used in the mapping
need to be kept. Deleting unused columns can save a substantial amount of time.
4) If a lookup is used several times in a mapping, and has not been changed, it
will, by default, keep the cache built earlier for subsequent loads in the mapping.
If this feature is not needed (for example, the first transform may have updated
the data, and now the second uses it in a lookup), ‘Recache from Database’ option
needs to be checked.
5) Dynamic lookup cache can be used when the target table is also the lookup
table. When a dynamic cache is used, the Informatica Server updates the lookup
cache as it passes rows to the target. The Informatica Server builds the cache
when it processes the first lookup request. It queries the cache based on the
lookup condition for each row that passes into the transformation. When the
Informatica Server reads a row from the source, it updates the lookup cache by
either Inserting the row into the cache or by Updating the row in the cache or by
Making no change to the cache.
6) If the lookup table is on the same database as the source table in the mapping
and there is a lot of data which is not feasible to cache, the tables can be joined in
the source database rather than using a Lookup transformation.
7) The Informatica Server generates an ORDER BY statement for a cached lookup
by default that contains all lookup ports. To increase performance, the default
ORDER BY statement can be suppressed and an override ORDER BY with fewer
columns can be written.
8) If a Lookup transformation specifies several conditions, the lookup
performance can be improved by placing all the conditions that use the equality
operator first in the list of conditions that appear under the Condition tab.
1) Rejected rows from an Update Strategy are logged to the Bad File. Filtering of
these rows should be considered if retaining these rows is not critical because
logging causes extra overhead on the engine.
2) When all the input data needs to be inserted into a target table, Insert option
should be selected for the Treat Source Rows As session property. Also, Insert
option should be selected for all target instances in the session.
3) When all the input data needs to be deleted, Delete option should be selected
for the Treat Source Rows As session property. Also, Delete option should be
selected for all target instances in the session.
4) When the input data needs to be updated on the contents of a target table,
Update option should be selected for the Treat Source Rows As session property.
Also, Update option should be selected for each target instance.
5) When different database operations need to be performed with different rows
destined for the same target table, either the DECODE or IIF function can be used
to flag rows for different operations (insert, delete, update, or reject). Also, Data
Driven should be selected for the Treat Source Rows As session property. Insert,
Delete, or one of the Update options should be selected for each target table
instance.
6) When the input data needs to be rejected, DECODE or IIF function can be used
to specify the criteria for rejecting the row. Also, Data Driven option should be
selected for the Treat Source Rows As session property.
1) Shared objects should always be kept in centralized folders since this will make
the maintenance simple apart from simplifying the process of copying folders into
a production repository.
2) Shortcuts need to be created only when it is a finalized object since making
changes to an object referenced by shortcuts can invalidate the mappings or
mapplets using the shortcut, as well as any sessions using these objects. To avoid
invalidating repository objects, only create shortcuts objects in their finalized
version.
3) Whenever a referenced shortcut object is changed, care should be taken to
check whether the change has affected the associated mappings or not. If any
object referenced by a shortcut needs to be changed, the Analyze Dependencies
features in the Repository Manager can be used to view affected mappings. After
editing the object, all the associated mappings need to be opened and validated
again.
4) When changes are made to shortcuts where more than one user is working on
the same environment, changes made by one user will not be reflected in the
other user’s workspace until the workspace is refreshed by either choosing Edit-
Revert To Saved option or by closing down the workspace and then reopening it.
2) By default, the Informatica Server uses the format string in the following
format MM/DD/YYYY HH24:MI:SS and this is not case-sensitive. So all the
date/time fields and string fields storing date values should be taken in
MM/DD/YYYY format in order to avoid wrong conversion of dates during internal
calculations.
4) Calculating or testing the same value over and over should be avoided. The
needed value should be calculated once in an expression, and by setting a
True/False flag can be used several times. Only needed ports to be connected. All
unnecessary links between transformations should be deleted to minimize the
amount of data moved, particularly in the Source Qualifier.
5) When DTM bottlenecks are identified and session optimization has not helped,
tracing levels should be used to identify which transformation is causing the
bottleneck (by using the Test Load option in session properties).
2. Transformations In Informatica
Properties
While configuring a Transaction Control transformation, the following
components need to be defined:
• Transformation tab. The transformation can be renamed and a description can
be added on the Transformation tab.
• Ports tab. Only input/output ports can be added to a Transaction Control
transformation.
• Properties tab. The transaction control expression can be defined to flag
transactions for commit, rollback, or no action.
• Metadata Extensions tab. The metadata stored in the repository by associating
information with the Transaction Control transformation can be extended.
Available Options
The following built-in variables can be used in the Expression Editor when a
transaction control expression is created:
• TC_CONTINUE_TRANSACTION. The Informatica Server does not perform any
transaction change for this row. This is the default value of the expression.
• TC_COMMIT_BEFORE. The Informatica Server commits the transaction, begins a
new transaction, and writes the current row to the target. The current row is in
the new transaction.
• TC_COMMIT_AFTER. The Informatica Server writes the current row to the
target, commits the transaction, and begins a new transaction. The current row is
in the committed transaction.
• TC_ROLLBACK_BEFORE. The Informatica Server rolls back the current
transaction, begins a new transaction, and writes the current row to the target.
The current row is in the new transaction.
• TC_ROLLBACK_AFTER. The Informatica Server writes the current row to the
target, rolls back the transaction, and begins a new transaction. The current row is
in the rolled back transaction.
Things to note
1) A Transaction Control is used to commit the data written to the output as per
our requirement.
2) The Informatica Server rolls back transactions in the following circumstances:
• Rollback evaluation. The transaction control expression returns a rollback value.
• Open transaction. You choose to roll back at the end of file.
• Roll back on error. You choose to roll back commit transactions if the
Informatica Server encounters a non-fatal error.
• Roll back on failed commit. If any target connection group in a target connection
unit fails to commit, the Informatica Server rolls back all uncommitted data to the
last successful commit point.
3) In order to overcome the above rollback, Transaction control can be set up
such that data is available even after any of the above situation arises.
4) A Transaction control will become ineffective if it is used before an active
transformation.
5) When there are more than one target in a mapping and when all of these
targets are not connected to an effective Transaction control then the mapping
will become invalid.
Things to note
1) A stored procedures transformation is used to: Check the status of a target
database before loading data into it or to Determine if enough space exists in a
database or to Perform a specialized calculation or to Drop and recreate indexes.
2) The stored procedure must exist in the database before creating a Stored
Procedure transformation.
3) A stored procedure can be used to perform a query or calculation that you
would otherwise make part of a mapping.
4) The Stored Procedure transformation can be set up in one of two modes, either
connected or unconnected.
5) A stored procedure can be imported from the database, by which the Designer
creates ports based on the stored procedure input and output parameters.
The Rank transformation allows selecting only the top or bottoming rank of data.
Rank transformation can be used to return the largest or smallest numeric value
in a port or group. Rank transformation can also be used to return the strings at
the top or the bottom of a session sort order.
The Rank transformation differs from the transformation functions MAX and MIN,
in that it allows selecting a group of top or bottom values, not just one value.
Properties
While creating a Rank transformation, the following properties need to be
configured:
• Cache directory: Used to store data temporarily while sorting
• Top/Bottom: Used to indicate whether to select top or bottom ranked data.
• Number of Ranks: Used to indicate the number of ranked records to be fetched.
• The input/output port that contains values used to determine the rank need to
be selected along with selecting one port to define a rank.
• Groups can be specified for ranks if data needs to be ranked based on each
group.
Things to note
1) A port RANKINDEX will be created for each Rank transformation which is used
by the Informatica Server to Rank Index port in order to store the ranking position
for each row in a group.
2) Local variables can be created inside a rank transformation and non-aggregate
expressions can be used.
3) Rank transformation changes the number of output rows in two different ways
à By filtering all but the rows falling within a top or bottom rank or by defining
groups which create one set of ranked rows for each group.
4) If two rank values match, they receive the same value in the rank index and the
transformation skips the next value.
Image here rnk_mapping.bmp
Transformation Notes
Informatica Transformation
Source qualifier: - Read data from flat file and relational source. It has capability
to override this default query by changing the default settings.
We can handle this update Strategy in Session level also Within a session. Session
– Mapping - Target – Select
Normal Join: With a Normal join, the Informatica Server discards all rows of data
from the master and detail source that do not match, based on the condition.
Master Outer Join: A Master Outer Join keeps all rows of data from the detail
source and the matching rows from the master source. It discards the unmatched
rows from the master source.
Detail Outer Join: A Detail Outer Join keeps all rows of data from the master
source and the matching rows from the detail source. It discards the unmatched
rows from the detail source.
Full Outer Join: A Full Outer Join keeps all rows of data from both the master and
detail sources.
External Procedure - Call compiled code for each row. External procedure is
calling a component...externally, and stored procedure is called from the
transformation. It is set of sql statements.
Connected / Unconnected
Part of Mapping Data Flow / Separate from the mapping data flow
Return multiple Values / Return one value
Receive input value directly Receive input value / from the pipeline. from the
result of a:LKP expression in another transformation
Unconnected lookup should be used when we need to call same lookup multiple
times in one mapping. For example, in a parent child relationship you need to
pass multiple child ids’s to get respective parent id's.
If u need to calculate a value for all the rows or for the maximum rows coming out
of the source then go for a connected lookup, Or, if it is not so then go for
unconnected lookup
1) Source Qualifier
2) Expression;
3) Lookup ( It send Null Value if there is no value;
4) Sequence Generator;
5) External Stored Procedure
6) Advanced External Stored Procedure.
Ports- Input, Output, Variable, Return/Rank, Lookup and Master? Variable ports
are used to store intermediate results. Variable ports can reference input ports
and variable ports, but not output ports.
It is the work place where raw data is brought in, cleaned, combined, archived and exported to
one or more data marts. The purpose of data staging area is to get data ready for loading into a
presentation layer.
SCD stands for slowly changing dimensions. Slowly changing dimensions are of three types
Type 3: by adding new columns to target table we maintain historical information and current
information
Dimension Table is master tables. It is a descriptive data about the facts (business).
Dimension tables are usually smaller and hold descriptive data that reflects the dimensions, or
attributes, of a business.
Fact table A pure fact table is collection of foreign keys. A fact table contains measurable or
factual data about an organization.
Fact tables contain the factual data about a business can consist of many columns and millions or
billions of rows
Aggregate tables are pre-stored summarized tables. Usage of Aggregates can increase the
performance of Queries by several times.
Lookup table is the one which is used when updating a warehouse. It just updates the table by
allowing only new records or updated records based on the lookup condition.
SDLC
Analysis:
Analysis Source and Target.
Source – It could be External or Internal – Study Data (person, financial), Structure and
Frequency
Target – Ours or ftp –what is going to add or modified.
Find out natural and sour gate keys
Design -
How to extract / pull the data from source
How to load / insert /update delete target side
Incremental logic
What is the flow between tables?
Sequence of load of tables
Sequence of jobs
Development
Data mapping source to target
Transformation logic involved
Start real informatica mapping
Review code / JAD
Test with cases – Sql comments
Re-development / fix bugs
Implementation
How to deploy from Dev / Test / Prod
Follow SDLC process
Bug Fixing
Get Data certification from users
Data Profiling:
Profile data of the source
If target table needs to profiled bring it as source definition
It create the mapping
Data Validation
Source – Analysis
Target – Auditing the level
Taken certifying by users
Schema
Schema
Schema is a Collection of Database object of a user that includes - Tables, Views, Synonyms,
Sequences, Clusters, Triggers, Procedures, and Packages.
The snowflake and star schema are methods of storing data which are multidimensional in nature
Star Schema is the collection of fact and dimensions where one fact is surrounded by several
dimension. This is the best way to get result by queries.
Snowflake schema -Collection of Star Schema. One dimension table will be connected to
another dimension table and so on.
Snowflake Schema, each dimension has a primary dimension table, to which one or more
additional dimensions can join.
The primary dimension table is the only table that can join to the fact table
Differences between star and snowflake schemas?
Star schema - all dimensions will be linked directly with a fact table.
Snow schema - dimensions maybe interlinked or may have one-to-many relationship with other
tables.
BUS Schema is composed of a master suite of confirmed dimension and standardized definition
if facts.
View
View is set of sql statements together which join single or multiple tables and shows the data.
Views do not contain data.
Materialized view .These views contain the data itself. Reason being it is easier/faster to access
the data. Mainly used in Data warehousing.
The main purpose of Materialized view is to do calculations and display data from multiple
tables using joins.
Teradata – Loaders
Teradata – Loaders
The Teradata load utilities are designed to load massive amounts of data in a short amount of
time. Loading using ODBC should be considered for very small tables only.
Fastload:
FastLoad inserts large volumes of data very rapidly into Teradata tables.
It can load one table from multiple input files.
Table being loaded must be empty.
Multiload:
Multiload supports insert, update, delete, and upsert operations for up to five target tables.
It can apply conditional logic to determine what updates to apply.
Its speed approaches that of Fastload. Multiload is limited to one input file.
Tpump:
Tpump is generally used for low volume maintenance of large tables, and/or near real-time
maintenance.
It does row-at-a-time processing using SQL
It is slower than Fastload and Multiload.
Tpump does not support multiple input files.
We run the script ( Fastload / Multiload / Tpump) thru Informatica sessions and edit if there is
any reserve word like month, type, cycle - wrap up with double quotes thru VI editor
OLTP / OLAP
OLTP
On Line Transaction Processing which contains a normalized tables and online data which have
frequent insert/updates/delete.
Current data
Short database transactions
Online update/insert/delete
Normalization is promoted
High volume transactions
Transaction recovery is necessary
Since in OLTP, tables are normalized and hence query response will be slow for end user.
OLAP
Online Analytical Programming contains the history of OLTP data is used for creating
forecasting reports
Current and historical data
Long database transactions
Batch update/insert/delete
Demoralization is promoted
Low volume transactions
Transaction recovery is not necessary
Normalization
Normalization
1st Normal form - Eliminate duplicative columns from the same table. Create separate tables for
each group
2nd Normal form Meet all the requirements of the first normal form.
Remove subsets of data that apply to multiple rows of a table and place them in separate tables.
Create relationships between these new tables through the use of foreign keys.
Remove columns that are not dependent upon the primary key.
in the 5NF if and only if every join dependency in it is implied by the candidate keys.
Denormalized
A demoralized database is one that has been meticulously normalized to eliminate redundancies,
only to have redundancies deliberately put back in to meet other needs.
Data warehouse
Data Mart – A data mart is a focused subset of a data warehouse that deals with a single area
(like different department) of data and is organized for quick analysis
E.g.: sales, marketing etc.
Differences between DWH & Data Mart: DWH is used on an enterprise level, while data
marts are used on a business division / department level.
Conformed Dimension
Conformed dimension The dimension which is used more than one fact table is called
conformed dimensions. Confirmed dimensions are the dimensions which can be used in multiple
star schemas
Cardinality
Cardinality describes a join between 2 tables by stating how many rows of one table will match
with rows of another table.