Académique Documents
Professionnel Documents
Culture Documents
Informatica:SourceQualifierTransformation.
0
More NextBlog
CreateBlog SignIn
Informatica
Normalizertransformation
RankTransformation
SourceQualifierTransformation.
Routertransformation
UnionTransformation.
SequenceTransformation
SorterTransformation
AggregatorTransformation
SourceQualifierTransformation.
Chapter21.SourceQualifierTransformation
ActiveandConnected.
TheSourceQualifiertransformationrepresentstherowsthattheIntegrationServicereadswhenitrunsasession.
WecanuseSQtocompletefollowingtasks:
1. Joindataoriginatingfromthesamesourcedatabase.
2. FilterrowswhentheIntegrationServicereadssourcedata.(bymakinguseoffiltercondition).
3. Specifyanouterjoinratherthanthedefaultinnerjoin./*couldnottest*/
4. Specifysortedports.
5. Selectonlydistinctvaluesfromthesource.
6. CreateacustomquerytoissueaspecialSELECTstatementfortheIntegrationServicetoreadsourcedata.
Transformationdatatypes:
TheSourceQualifiertransformationdisplaysthetransformationdatatypewhichdeterminehowsourcedatabasebindsdatawhenthe
IntegrationServicereadsit.IfthedatatypesinthesourcedefinitionandSourceQualifiertransformationdonotmatch,theDesigner
marksthemappinginvalidwhenyousaveit.
TargetLoadorder:
WespecifyatargetloadorderbasedontheSourceQualifiertransformationsinamapping.IfyouhavemultipleSourceQualifier
transformationsconnectedtomultipletargets,youcandesignatetheorderinwhichtheIntegrationServiceloadsdataintothe
targets.
DateTimevalues:
WhenyouuseadatetimevalueoradatetimeparameterorvariableintheSQLquery,changethedateformattotheformatusedin
thesource.Somedatabasesrequireyoutoidentifydatetimevalueswithadditionalpunctuation,suchassinglequotationmarksor
databasespecificfunctions.Forexample,toconvertthe$$$SessStartTimevalueforanOraclesource,usethefollowingOracle
functionintheSQLoverride:
to_date($$$SessStartTime,mm/dd/yyyyhh24:mi:ss)
UsingParametersandVariablesinsourcequalifier:
YoucanuseparametersandvariablesintheSQLquery,userdefinedjoin,sourcefilter,andpreandpostsessionSQLcommandsofaSource
Qualifiertransformation.
YoucanenteraparameterorvariablewithintheSQLstatement,oryoucanuseaparameterorvariableastheSQLquery.Forexample,you
canuseasessionparameter,$ParamMyQuery,astheSQLquery,andset$ParamMyQuerytotheSQLstatementinaparameterfile.
SourceQualifiertransformationproperties:
Setting
Description
SQLQuery
Definesacustomquerythatreplacesthedefaultquerythe
IntegrationServiceusestoreaddatafromsourcesrepresentedin
thisSourceQualifiertransformation
UserDefined
Join
Specifiestheconditionusedtojoindatafrommultiplesources
representedinthesameSourceQualifiertransformation.
SourceFilter
SpecifiesthefilterconditiontheIntegrationServiceapplieswhen
queryingrows.
Numberof
SortedPorts
Indicatesthenumberofcolumnsusedwhensortingrowsqueried
fromrelationalsources.Ifyouselectthisoption,theIntegration
ServiceaddsanORDERBYtothedefaultquerywhenitreads
sourcerows.
TracingLevel
Setstheamountofdetailincludedinthesessionlogwhenyourun
asessioncontainingthistransformation.
SelectDistinct
Specifiesifyouwanttoselectonlyuniquerows.
PreSQL
PresessionSQLcommandstorunagainstthesourcedatabase
beforetheIntegrationServicereadsthesource.
PostSQL
PostsessionSQLcommandstorunagainstthesourcedatabase
aftertheIntegrationServicewritestothetarget.
Outputis
Deterministic
Relationalsourceortransformationoutputthatdoesnotchange
betweensessionrunswhentheinputdataisconsistentbetween
runs.Whenyouconfigurethisproperty,the
IntegrationServicedoesnotstagesourcedataforrecoveryif
transformationsinthepipelinealwaysproducerepeatabledata.
http://informaticasukul.blogspot.in/p/sourcequalifiertransformation.html
1/7
5/28/2015
Informatica:SourceQualifierTransformation.
Outputis
Repeatable
Relationalsourceortransformationoutputthatisinthesameorder
betweensessionrunswhentheorderoftheinputdatais
consistent.Whenoutputisdeterministicandoutputis
repeatable,theIntegrationServicedoesnotstagesourcedatafor
recovery.
WhatisaDefaultQuery?
Forrelationalsources,theIntegrationServicegeneratesaqueryforeachSourceQualifiertransformationwhenitrunsasession.
ThedefaultqueryisaSELECTstatementwithonlythecolumnsthatareconnectedtoanothertransformation.
Althoughtherearemanycolumnsinthesourcedefinition,onlythreecolumnsareconnectedtoanothertransformation.Inthiscase,the
IntegrationServicegeneratesadefaultquerythatselectsonlythosethreecolumns:
SELECTCUSTOMERS.CUSTOMER_ID,CUSTOMERS.COMPANY,CUSTOMERS.FIRST_NAMEFROMCUSTOMERS
YoucanviewthedefaultqueryintheSourceQualifiertransformation.FromthePropertiestab,selectSQLQueryandthenclickGenerateSQL.
*******************************************
CanweoverridethedefaultquerygeneratedbySourceQualifier?
YoucanalteroroverridethedefaultqueryintheSourceQualifiertransformationbychangingthedefaultsettingsofthetransformation
properties.
Donotchangethelistofselectedportsortheorderinwhichtheyappearinthequery.Thislistmustmatchtheconnected
transformationoutputports.
TheSQLQueryoverridestheUserDefinedJoin,SourceFilter,NumberofSortedPorts,andSelectDistinctsettingsintheSourceQualifier
transformation.
************************************
HowdowejoindatainSourceQualifier?
WecanuseoneSourceQualifiertransformationtojoindatafrommultiplerelationaltables.Thesetablesmustbeaccessiblefromthe
sameinstanceordatabaseserver.ThustablesmustbeinthesamedatabaseinstancetobeabletojointheminSQ.Ifnotthenwe
havetouseJoinerTransformation.Wecalltheseasheterogeneousjoins.
Toperformaheterogeneousjoin,usetheJoinertransformation.
Joindatafromdifferentsourcedatabases
Joindatafromdifferentflatfilesystems
Joinrelationalsourcesandflatfiles
WhatisDefaultJoin?
WhenyoujoinrelatedtablesinoneSourceQualifiertransformation,theIntegrationServicejoinsthetablesbasedontherelatedkeys(PK
FK)ineachtable.
Thisdefaultjoinisaninnerequijoin,usingthefollowingsyntaxintheWHEREclause:
Source1.column_name=Source2.column_name
Thecolumnsinthedefaultjoinmusthave:
Aprimarykeyforeignkeyrelationship
Matchingdatatypes.
CUSTOMERSandORDERStableshavePKFKrelation.
WejoinquerycanalsobeviewedbydoingGENERATESQL.
Inabovecasethequerywouldlooklike:
http://informaticasukul.blogspot.in/p/sourcequalifiertransformation.html
2/7
5/28/2015
Informatica:SourceQualifierTransformation.
Inabovecasethequerywouldlooklike:
SELECTCUSTOMERS.CUSTOMER_ID,CUSTOMERS.COMPANY,CUSTOMERS.FIRST_NAME,CUSTOMERS.LAST_NAME,
CUSTOMERS.ADDRESS1,CUSTOMERS.ADDRESS2,CUSTOMERS.CITY,CUSTOMERS.STATE,CUSTOMERS.POSTAL_CODE,
CUSTOMERS.PHONE,CUSTOMERS.EMAIL,
ORDERS.ORDER_ID,ORDERS.DATE_ENTERED,ORDERS.DATE_PROMISED,ORDERS.DATE_SHIPPED,ORDERS.EMPLOYEE_ID,
ORDERS.CUSTOMER_ID,ORDERS.SALES_TAX_RATE,ORDERS.STORE_IDFROMCUSTOMERS,ORDERS
WHERECUSTOMERS.CUSTOMER_ID=ORDERS.CUSTOMER_ID
TheWHEREclauseisanequijointhatincludestheCUSTOMER_IDfromtheORDERSandCUSTOMERtables.
Youmightneedtooverridethedefaultjoinunderthefollowingcircumstances:
Columnsdonothaveaprimarykeyforeignkeyrelationship.
Thedatatypesofcolumnsusedforthejoindonotmatch.
Youwanttospecifyadifferenttypeofjoin,suchasanouterjoin.
WecancreateprimarykeyforeignkeyrelationshipsasshownintheabovescreenshotintheSourceAnalyzerbylinkingmatchingcolumns
indifferenttables.Thesecolumnsdonothavetobekeys,buttheyshouldbeincludedintheindexforeachtable.
Forex:TheORDERSandPAYMENTStablesdonotshareprimaryandforeignkeys.Bothtables,however,includeaDATE_SHIPPED
column.YoucancreateaprimarykeyforeignkeyrelationshipinthemetadataintheSourceAnalyzer.
YoucreatearelationshipbetweentheORDERSandPAYMENTStablesbylinkingtheDATE_SHIPPEDcolumns.TheDesigneraddsprimaryand
foreignkeystotheDATE_SHIPPEDcolumnsintheORDERSandPAYMENTStabledefinitions.
Theprimarykeyforeignkeyrelationshipsexistinthemetadataonly.YoudonotneedtogenerateSQLoralterthesourcetables.
Oncethekeyrelationshipsexist,useaSourceQualifiertransformationtojointhetwotables.ThedefaultjoinisbasedonDATE_SHIPPED.
HowtooverridethedefaultQuery?
1.OpentheSourceQualifiertransformation,andclickthePropertiestab.
2.ClicktheOpenbuttonintheSQLQueryfield.TheSQLEditordialogboxappears.
3.ClickGenerateSQL.
TheDesignerdisplaysthedefaultqueryitgenerateswhenqueryingrowsfromallsourcesincludedintheSourceQualifier
transformation.WhentheDesignergeneratesthedefaultquery,itincorporatesallotherconfiguredoptions,suchasa
filterornumberofsortedports.
4.Enteraqueryinthespacewherethedefaultqueryappears.
Everycolumnnamemustbequalifiedbythenameofthetable,view,orsynonyminwhichitappears.Forexample,ifyouwantto
includetheORDER_IDcolumnfromtheORDERStable,enterORDERS.ORDER_ID.
WhencreatingacustomSQLquery,theSELECTstatementmustlisttheportnamesintheorderinwhichtheyappearinthe
transformation.
5.SelecttheODBCdatasourcecontainingthesourcesincludedinthequery.
6.Entertheusernameandpasswordtoconnecttothisdatabase.
7.ClickValidate.
TheDesignerrunsthequeryandreportswhetheritssyntaxwascorrect.
8.ClickOKtoreturntotheEditTransformationsdialogbox.ClickOKagaintoreturntotheDesigner.
HowtoweenterUserDefinedJoins?
EnteringauserdefinedjoinissimilartoenteringacustomSQLquery,butweonlyenterthecontentsofthewhereclause.
Whenyouaddauserdefinedjoin,theSourceQualifiertransformationautomaticallyincludesthesettinginthedefaultSQLquery.
However,ifyoumodifythedefaultqueryafteraddingauserdefinedjoin,theIntegrationServiceusesonlythequerydefinedinthe
SQLQuerypropertyoftheSourceQualifiertransformation.
Wecanevenuseparametersorvariablesforuserdefinedjoinorincludeparametersandvariableswithinthejoin.
Importantnote:DonotenterthekeywordWHEREatthebeginningofthejoin.TheIntegrationServiceaddsthiskeywordwhenit
queriesrows.
Example:Inthebelowexample,wehavetwotablesTCCC800_ADDRESS_HISTORYandTCCC806_ADDRESSbeingjoinedusinguser
definedjoin.
Intheuserdefinedjoinvaluewecanusethepointandclickmethodtocreatethejoincondition.
http://informaticasukul.blogspot.in/p/sourcequalifiertransformation.html
3/7
5/28/2015
Informatica:SourceQualifierTransformation.
Whenyougeneratethedefaultquerywecanseethatthejoinconditionisautomaticallyaddedtothequery.Alsonotethattogeneratethe
defaultquerythesourcequalifiermustbeconnectedtonexttransformation.
Informaticajoinsyntax:
Whenyouenterjoinsyntax,usetheInformaticaordatabasespecificjoinsyntax.WhenyouusetheInformaticajoinsyntax,the
IntegrationServicetranslatesthesyntaxandpassesittothesourcedatabaseduringthesession.Alwaysadvisedtousedatabasespecific
Syntax.
WhenyouuseInformaticajoinsyntax,enclosetheentirejoinstatementinbraces({Informaticasyntax}).Whenyouusedatabasesyntax,
entersyntaxsupportedbythesourcedatabasewithoutbraces.
WhenusingInformaticajoinsyntax,usetablenamestoprefixcolumnnames.Forexample,ifyouhaveacolumnnamedFIRST_NAMEin
theREG_CUSTOMERtable,enterREG_CUSTOMER.FIRST_NAMEinthejoinsyntax.
FollowingisisthelistofplaceswherewecanaddthejoinsyntaxinsourceQualifiertransformation.
1. UserDefinedjoin:TheIntegrationServiceappendsthejoinoverridetotheWHEREorFROMclauseofthedefaultquery.
2. SQLquery:EnterjoinsyntaximmediatelyaftertheWHEREinthe
defaultquery.
Whenyoucombinejoins,entertheminthefollowingorder:
1.Normal
2.Leftouter
3. Rightouter
Youcancreateanormaljoinusingthejoinconditioninasourcequalifier.However,ifyouarecreatinganouterjoin,youneedto
overridethedefaultjointoperformanouterjoin.
IWASNOTABLETOTESTOUTERJOINOVERRIDEINTHEUSERDEFINEDJOIN.
HowdoweentertheSourcefilter?
WecanuseSourcefilteronpropertiestabtofilterrows.
WeshouldnotincludeWHEREinthecondition.
TheSourceQualifiertransformationincludessourcefiltersinthedefaultSQLquery.If,however,youmodifythedefaultqueryafter
addingasourcefilter,theIntegrationServiceusesonlythequerydefinedintheSQLqueryportionoftheSourceQualifier
transformation.
Youcanuseaparameterorvariableasthesourcefilterorincludeparametersandvariableswithinthesourcefilter.
InbelowexamplewewehaveaddedtheSourceFilter.
http://informaticasukul.blogspot.in/p/sourcequalifiertransformation.html
4/7
5/28/2015
Informatica:SourceQualifierTransformation.
HowtouseSortedPorts:
Whenyouusesortedports,theIntegrationServiceaddstheportstotheORDERBYclauseinthedefaultquery.
Wemightusesortedportstoimproveperformancewhenyouincludeaggregatororjoinerinourmapping.
UseSortedportsonlyforrelationalsources.
TheSourceQualifiertransformationincludesthenumberofsortedportsinthedefaultSQLquery.However,ifyoumodifythedefaultqueryafter
choosingtheNumberofSortedPorts,theIntegrationServiceusesonlythequerydefinedintheSQLQueryproperty.
AswecanseeWhenweaddnumberofSortedportsas5,thedefaultqueryautomaticallyincorporatestheORDERBYclauseonthefirst5ports.
HowdoweusetheDistinctoption?
IfyouwanttheIntegrationServicetoselectuniquevaluesfromasource,usetheSelectDistinctoption.
IfyouchooseSelectDistinct,theSourceQualifiertransformationincludesthesettinginthedefaultSQLquery.
However,ifyoumodifythedefaultqueryafterchoosingSelectDistinct,theIntegrationServiceusesonlythequerydefinedintheSQL
Queryproperty.
http://informaticasukul.blogspot.in/p/sourcequalifiertransformation.html
5/7
5/28/2015
Informatica:SourceQualifierTransformation.
ExplainPreSessionandPostSessionCommandTask:
WecanaddpreandpostsessionSQLcommandsonthePropertiestabintheSourceQualifiertransformation.
TheIntegrationServicerunspresessionSQLcommandsagainstthesourcedatabasebeforeitreadsthesource.ItrunspostsessionSQL
commands
againstthesourcedatabaseafteritwritestothetarget.
YoucanoverridetheSQLcommandsintheTransformationsviewontheMappingtabinthesessionproperties.
YoucanalsoconfiguretheIntegrationServicetostoporcontinuewhenitencounterserrorsrunningpreorpostsessionSQLcommands.
ThisCanbedoneontheconfigtabofsession.
YoucanuseparametersandvariablesinsourcepreandpostsessionSQLcommands,oryoucanuseaparameterorvariableasthecommand.
Useasemicolon()toseparatemultiplestatements.TheIntegrationServiceissuesacommitaftereachstatement.
TheIntegrationServiceignoressemicolonswithin/*...*/.
TheDesignerdoesnotvalidatetheSQL.
PreSessionexample:
PrePostsessionSqlerrorhandlinginsession:
Notes:
TheDesignerdoesnotallowyoutoconnectmultipleSourceQualifiertransformationstoasingletarget.Therearetwoworkarounds:
Reusetargets.Sincetargetdefinitionsarereusable,youcanaddthesametargettothemappingmultipletimes.ThenconnecteachSource
Qualifiertransformationtoeachtarget.
JointhesourcesinaSourceQualifiertransformation.ThenremovetheWHEREclausefromtheSQLquery.
Nocomments:
PostaComment
Enteryourcomment...
Commentas:
Publish
GoogleAccount
Preview
http://informaticasukul.blogspot.in/p/sourcequalifiertransformation.html
6/7