我需要创建一个可以对数据进行排序和排名的 Informatica 映射。两个不同的应用程序中有两个表,因此我无法直接在 SQL 中连接它们。两者都有大量数据,因此也需要照顾性能。 Senario 可能像下面这样-
有两张表Department(DEPT)和Employee(EMP)。它们有1(DEPT):M(EMP)关系。部门表有列 (Row_id, DeptNm, Created_date),员工表有列 (Row_id, EMPName, Emp_num, Par_row_id (FK to DEPT.row_Id),Salary)
对于特定部门,按照员工工资递减的顺序对数据进行排序并排序。数据应位于文本文件中,如下所示 -
部门名称|员工名称|薪资|职级
金融|维克拉姆|200000|1
金融|Uttaam|150000|2
金融|Rajeev|100000|3
ITDPPT|巴拉吉|150000|1
IT部门|Harsha|120000|2
ITDEPT|Weeniji|100000|3
提前致谢:)
您可以使用连接器转换来连接部门和员工表。然后使用排序器和排名转换对行进行排名。
Created sample informatica mapping which includes multiple transformations.
<?xml version="1.0" encoding="UTF-8"?>
<POWERMART CREATION_DATE="2024-05-11 12:00:00" REPOSITORY_VERSION="182.92">
<REPOSITORY DATABASETYPE="Oracle" NAME="My_Repository" VERSION="182.92"/>
<FOLDER NAME="My_Folder" GROUP="Workgroup">
<SOURCE BUSINESSNAME="" DATABASETYPE="Oracle" DESCRIPTION="" NAME="Employee_Source" OBJECTVERSION="1" VERSIONNUMBER="1">
<SOURCEFIELD DATATYPE="integer" DESCRIPTION="" NAME="Employee_ID" NULLABLE="NULL"/>
<SOURCEFIELD DATATYPE="string" DESCRIPTION="" NAME="Employee_Name" NULLABLE="NULL"/>
<SOURCEFIELD DATATYPE="string" DESCRIPTION="" NAME="Department" NULLABLE="NULL"/>
<SOURCEFIELD DATATYPE="decimal" DESCRIPTION="" NAME="Salary" NULLABLE="NULL"/>
</SOURCE>
<TARGET BUSINESSNAME="" CONSTRAINED="NO" DATABASETYPE="Oracle" DESCRIPTION="" NAME="Employee_Target" OBJECTVERSION="1" TABLEOPTIONS="COMPRESS FOR OLTP" VERSIONNUMBER="1">
<TARGETFIELD DATATYPE="integer" DESCRIPTION="" KEYTYPE="NOT A KEY" NAME="Employee_ID" NULLABLE="NULL"/>
<TARGETFIELD DATATYPE="string" DESCRIPTION="" KEYTYPE="NOT A KEY" NAME="Employee_Name" NULLABLE="NULL"/>
<TARGETFIELD DATATYPE="string" DESCRIPTION="" KEYTYPE="NOT A KEY" NAME="Department" NULLABLE="NULL"/>
<TARGETFIELD DATATYPE="decimal" DESCRIPTION="" KEYTYPE="NOT A KEY" NAME="Salary_Adjusted" NULLABLE="NULL"/>
<TARGETFIELD DATATYPE="decimal" DESCRIPTION="" KEYTYPE="NOT A KEY" NAME="Average_Salary" NULLABLE="NULL"/>
</TARGET>
<MAPPING DESCRIPTION="" ISVALID="YES" NAME="Employee_Mapping" OBJECTVERSION="1" VERSIONNUMBER="1">
<TRANSFORMATION DESCRIPTION="Source Qualifier" NAME="SQ_Employee_Source" OBJECTVERSION="1" REUSABLE="NO" TYPE="Source Qualifier">
<TRANSFORMFIELD DATATYPE="integer" DEFAULTVALUE="" DESCRIPTION="" EXPRESSION="" EXPRESSIONTYPE="GENERAL" NAME="Employee_ID" NULLABLE="NULL"/>
<TRANSFORMFIELD DATATYPE="string" DEFAULTVALUE="" DESCRIPTION="" EXPRESSION="" EXPRESSIONTYPE="GENERAL" NAME="Employee_Name" NULLABLE="NULL"/>
<TRANSFORMFIELD DATATYPE="string" DEFAULTVALUE="" DESCRIPTION="" EXPRESSION="" EXPRESSIONTYPE="GENERAL" NAME="Department" NULLABLE="NULL"/>
<TRANSFORMFIELD DATATYPE="decimal" DEFAULTVALUE="" DESCRIPTION="" EXPRESSION="" EXPRESSIONTYPE="GENERAL" NAME="Salary" NULLABLE="NULL"/>
</TRANSFORMATION>
<TRANSFORMATION DESCRIPTION="Expression Transformation" NAME="Exp_Employee_Salary_Adjusted" OBJECTVERSION="1" REUSABLE="NO" TYPE="Expression">
<TRANSFORMFIELD DATATYPE="decimal" DEFAULTVALUE="" DESCRIPTION="" EXPRESSION="Salary * 1.1" EXPRESSIONTYPE="GENERAL" NAME="Salary_Adjusted" NULLABLE="NULL"/>
</TRANSFORMATION>
<TRANSFORMATION DESCRIPTION="Filter Transformation" NAME="Ftr_Employee_Salary_Filter" OBJECTVERSION="1" REUSABLE="NO" TYPE="Filter">
<TRANSFORMFIELD DATATYPE="integer" DEFAULTVALUE="" DESCRIPTION="" EXPRESSION="Salary_Adjusted >= 50000" EXPRESSIONTYPE="GENERAL" NAME="Employee_ID" NULLABLE="NULL"/>
</TRANSFORMATION>
<TRANSFORMATION DESCRIPTION="Aggregator Transformation" NAME="Agr_Employee_Avg_Salary" OBJECTVERSION="1" REUSABLE="NO" TYPE="Aggregator">
<TRANSFORMFIELD DATATYPE="decimal" DEFAULTVALUE="" DESCRIPTION="" EXPRESSION="AVG(Salary)" EXPRESSIONTYPE="GENERAL" `enter code here`NAME="Average_Salary" NULLABLE="NULL"/>
<GROUP DATATYPE="string" NAME="Department"/>
</TRANSFORMATION>
<CONNECTOR FROMFIELD="Employee_ID" FROMINSTANCE="SQ_Employee_Source" FROMINSTANCETYPE="Source Qualifier" TOFIELD="Employee_ID" TOINSTANCE="Exp_Employee_Salary_Adjusted" TOINSTANCETYPE="Expression"/>
<CONNECTOR FROMFIELD="Employee_Name" FROMINSTANCE="SQ_Employee_Source" FROMINSTANCETYPE="Source Qualifier" TOFIELD="Employee_Name" TOINSTANCE="Exp_Employee_Salary_Adjusted" TOINSTANCETYPE="Expression"/>
<CONNECTOR FROMFIELD="Department" FROMINSTANCE="SQ_Employee_Source" FROMINSTANCETYPE="Source Qualifier" TOFIELD="Department" TOINSTANCE="Exp_Employee_Salary_Adjusted" TOINSTANCETYPE="Expression"/>
<CONNECTOR FROMFIELD="Salary" FROMINSTANCE="SQ_Employee_Source" FROMINSTANCETYPE="Source Qualifier" TOFIELD="Salary" TOINSTANCE="Exp_Employee_Salary_Adjusted" TOINSTANCETYPE="Expression"/>
<CONNECTOR FROMFIELD="Salary_Adjusted" FROMINSTANCE="Exp_Employee_Salary_Adjusted" FROMINSTANCETYPE="Expression" TOFIELD="Salary_Adjusted" TOINSTANCE="Ftr_Employee_Salary_Filter" TOINSTANCETYPE="Filter"/>
<CONNECTOR FROMFIELD="Employee_ID" FROMINSTANCE="Ftr_Employee_Salary_Filter" FROMINSTANCETYPE="Filter" TOFIELD="Employee_ID" TOINSTANCE="Agr_Employee_Avg_Salary" TOINSTANCETYPE="Aggregator"/>
<CONNECTOR FROMFIELD="Department" FROMINSTANCE="Ftr_Employee_Salary_Filter" FROMINSTANCETYPE="Filter" TOFIELD="Department" TOINSTANCE="Agr_Employee_Avg_Salary" TOINSTANCETYPE="Aggregator"/>
<CONNECTOR FROMFIELD="Salary_Adjusted" FROMINSTANCE="Exp_Employee_Salary_Adjusted" FROMINSTANCETYPE="Expression" TOFIELD="Salary_Adjusted" TOINSTANCE="Employee_Target" TOINSTANCETYPE="Target Definition"/>
<CONNECTOR FROMFIELD="Average_Salary" FROMINSTANCE="Agr_Employee_Avg_Salary" FROMINSTANCETYPE="Aggregator" TOFIELD="Average_Salary" TOINSTANCE="Employee_Target" TOINSTANCETYPE="Target Definition"/>
</MAPPING>
</FOLDER>
</POWERMART>