Вы находитесь на странице: 1из 6

SOURCE QUALIFIER T/F

Active and Connected Transformation. The Source Qualifier transformation represents the rows that the Power Center Server reads when it runs a session. It is only transformation that is not reusable. Default transformation except in case of !" or C#$#" files. Tasks performed by Source Qualifier: %oin data ori&inatin& from the same source database' (e can )oin two or more tables with primary *ey+forei&n *ey relationships by lin*in& the sources to one Source Qualifier transformation. ,ilter rows when the Power Center Server reads source data' If we Include a filter condition- the Power Center Server adds a (./0/ clause to the Default 1uery. Specify an outer )oin rather than the default inner )oin' If we include a 2ser+defined )oin- the Power Center Server replaces the )oin information Specified by the metadata in the SQ" 1uery. Specify sorted ports' If we specify a number for sorted ports- the Power Center Server adds an #0D/0 $3 clause to the default SQ" 1uery. Select only distinct values from the source' If we choose Select Distinct-the Power Center Server adds a S/"/CT DISTI4CT statement to the default SQ" 1uery. Create a custom 1uery to issue a special S/"/CT statement for the Power Center Server to read source data' ,or example- you mi&ht use a Custom 1uery to perform a&&re&ate calculations. The entire above are possible in Properties Tab of Source Qualifier t5f. SAMPLE MAPPING TO BE MA E:

Source will be /!P and D/PT tables. Create tar&et table as showed in Picture above. Create shortcuts in your folder as needed. !rea"i#$ Mappi#$: 6. #pen folder where we want to create the mappin&. 7. Clic* Tools +8 !appin& Desi&ner. 9. Clic* !appin&+8 Create+8 :ive mappin& name. /x' m;SQ;example <. Dra& /!P- D/PT- Tar&et. =. 0i&ht Clic* SQ;/!P and Select Delete from the mappin&. >. 0i&ht Clic* SQ;D/PT and Select Delete from the mappin&. ?. Clic* Transformation +8 Create +8 Select Source Qualifier from "ist +8 :ive 4ame +8 Clic* Create @. Select /!P and D/PT both. Clic* #A. B. "in* all as shown in above picture. 6C. /dit SQ +8 Properties Tab +8 #pen 2ser defined %oin +8 :ive %oin condition /!P.D/PT4#DD/PT.D/PT4#. Clic* Apply +8 #A 66. !appin& +8 Ealidate 67. 0epository +8 Save Create Session and (or*flow as described earlier. 0un the (or*flow and see the data in tar&et table. !a*e sure to &ive connection information for all tables. SQ P%OPE%TIES TAB &' SO(%!E )ILTE%: (e can enter a source filter to reduce the number of rows the Power Center Server 1ueries. No"e: (hen we enter a source filter in the session properties- we override the customiFed SQ" 1uery in the Source Qualifier transformation. S"eps:

6. In the !appin& Desi&ner- open a Source Qualifier transformation. 7. Select the Properties tab. 9. Clic* the #pen button in the Source ,ilter field. <. In the SQ" /ditor Dialo& box- enter the filter. /xample' /!P.SA"G7CCC =. Clic* #A. Ealidate the mappin&. Save it. 4ow refresh session and save the chan&es. 4ow run the wor*flow and see output. *' N(MBE% O) SO%TE PO%TS: (hen we use sorted ports- the Power Center Server adds the ports to the #0D/0 $3 clause in the default 1uery. $y default it is C. If we chan&e it to 6- then the data will be sorted by column that is at the top in SQ. /xample' D/PT4# in above fi&ure. If we want to sort as per /4A!/- move /4A!/ to top. If we chan&e it to 7- then data will be sorted by top two columns. S"eps: 6. In the !appin& Desi&ner- open a Source Qualifier transformation. 7. Select the Properties tab. 9. /nter any number instead of Fero for 4umber of Sorted ports. <. Clic* Apply +8 Clic* #A. Ealidate the mappin&. Save it. 4ow refresh session and save the chan&es. 4ow run the wor*flow and see output. +' SELE!T ISTIN!T: If we want the Power Center Server to select uni1ue values from a sourcewe can use the Select Distinct option. %ust chec* the option in Properties tab to enable it. ,' P%E a#d POST SQL !omma#ds

The Power Center Server runs pre+session SQ" commands a&ainst the source database before it reads the source. It runs post+session SQ" commands a&ainst the source database after it writes to the tar&et. 2se a semi+colon HIG to separate multiple statements.

-' (SE% E)INE .OINS /nterin& a user+defined )oin is similar to enterin& a custom SQ" 1uery. .owever- we only enter the contents of the (./0/ clause- not the entire 1uery. (e can specify e1ui )oin- left outer )oin and ri&ht outer )oin only. (e Cannot specify full outer )oin. To use full outer )oin- we need to write SQ" Query. S"eps: 6. #pen the Source Qualifier transformation- and clic* the Properties tab. 7. Clic* the #pen button in the 2ser Defined %oin field. The SQ" /ditor Dialo& $ox appears. 9. /nter the syntax for the )oin. <. Clic* #A +8 A&ain #*. Ealidate the mappin&. Save it. 4ow refresh session and save the chan&es. 4ow run the wor*flow and see output. .oi# Type /1ui %oin "eft #uter %oin 0i&ht #uter %oin Sy#"a/ D/PT.D/PT4#D/!P.D/PT4# J/!P "/,T #2T/0 %#I4 D/PT #4 D/PT.D/PT4#D/!P.D/PT4#K J/!P 0I:.T #2T/0 %#I4 D/PT #4 D/PT.D/PT4#D/!P.D/PT4#K

0' SQL Q(E%1

,or relational sources- the Power Center Server &enerates a 1uery for each Source Qualifier transformation when it runs a session. The default 1uery is a S/"/CT statement for each source column used in the mappin&. In other words- the Power Center Server reads only the columns that are connected to another Transformation. In mappin& above- we are passin& only SA" and D/PT4# from SQ;/!P to A&&re&ator transformation. Default 1uery &enerated will be' S/"/CT /!P.SA"- /!P.D/PT4# ,0#! /!P 2ie3i#$ "4e efaul" Query 6. #pen the Source Qualifier transformation- and clic* the Properties tab. 7. #pen SQ" Query. The SQ" /ditor displays. 9. Clic* :enerate SQ". <. The SQ" /ditor displays the default 1uery the Power Center Server uses to Select source data. =. Clic* Cancel to exit. No"e: If we do not cancel the SQ" 1uery- the Power Center Server overrides the default 1uery with the custom SQ" 1uery. (e can enter an SQ" statement supported by our source database. $efore enterin& the 1uery- connect all the input and output ports we want to use in the mappin&. E/ample: As in our case- we canLt use full outer )oin in user defined )oin- 3e ca# 3ri"e SQL 5uery for )(LL O(TE% .OIN: S/"/CT D/PT.D/PT4#- D/PT.D4A!/- D/PT."#C- /!P./!P4#- /!P./4A!//!P.%#$- /!P.SA"- /!P.C#!!- /!P.D/PT4# ,0#! /!P ,2"" #2T/0 %#I4 D/PT #4 D/PT.D/PT4#D/!P.D/PT4# (./0/ SA"87CCC (e also added (./0/ clause. (e can enter more conditions and write !ore complex SQ". (e can write any 1uery. (e can )oin as many tables in one 1uery as 0e1uired if all are in same database. It is very handy and used in most of the pro)ects. Impor"a#" Poi#"s: (hen creatin& a custom SQ" 1uery- the S/"/CT statement must list the port names in the order in which they appear in the transformation. /xample' D/PT4# is top columnI D4A!/ is second in our SQ mappin&. So when we write SQ" Query- S/"/CT statement have name D4A!/ firstD4A!/ second and so on. S/"/CT D/PT.D/PT4#- D/PT.D4A!/ #nce we have written a custom 1uery li*e above- then this 1uery will Always be used to fetch data from database. In our example- we used (./0/ SA"87CCC. 4ow if we use Source ,ilter and &ive condition SA"G 6CCC or any other- then it will not wor*. Informatica will always use the custom 1uery only.

!a*e sure to test the 1uery in database first before usin& it in SQ" Query. If 1uery is not runnin& in database- then it wonLt wor* in Informatica too. Also always connect to the database and validate the SQ" in SQ" 1uery editor

Вам также может понравиться