Unconnected lookup sql override issue - etl

I have unconnected lookup lkp_tst with the below ports - x,y,z - all these 3 fields are strings.
This unconnected lookup port has x as the return port
Also added i/p port (ipp) - to define the lookup cond
Cond: x=ipp
Written SQL override query in lookup transf. as
select x+''+y+''+z as x from test
the test table is created in SQL server DB
From the expr. transf. - am calling the unconnected lkp
:lkp.lkp_tst('abc')
Now when I try to try to debug it - it always returns
But however when I don't override the query in lkp transformation - I see the x been returned.
My objective is to return the concatenated value from the unconnected
lookup. Please advise.

Related

Get only one row from jdbcTemplate query for performance optimization

jdbcTemplate.query(getQuery(id),
rs -> {
if(rs.next()) {
mainDTO.setSim(rs.getString("sim"));
mainDTO.setImei(rs.getString("imei"));
}
});
I use above code fragment to retrieve data from database and getting more than 100 records. But for all the records, sim and imei numbers are same. other fields are different. When executing above code I can get sim and imei number from the first record itself. but query run on all over the records and hence it take more than 3 seconds to complete. here is the problem.
How I can stop retrieving other records after I got the value for sim and imei from the first record. I cant change the sql query as the documentation and need to do the optimization in java code itself.
how can I optimize this to perform within below 100 mills.
You have two choices, either limit using a SQL query or use JdbcTemplate#setMaxRows:
SQL
You need to edit the query including what columns are about to be selected and the table name:
SELECT * FROM table LIMIT 1
JDBC
Use JdbcTemplate#setMaxRows to configure the JdbcTemplate to return up to one row:
jdbcTemplate.setMaxRows(1);
I guess it mimics Statement#setMaxRows.

Informatica routers

I have two sources A source B
Source A passes through a drug lookup and a router to see if the NDC is present and if not goes to either a present table or a nonpresent table.
Source B does the same but only looks for GCN number if it is present then it goes to a GCN present table or a gcn not present table.
I am currently using in Group filters
ISNULL(NDC_DRUG_CODE_LOOKUP)
NOT ISNULL(NDC_DRUG_CODE_LOOKUP)
ISNULL (GCN_CODE_out_LKP)
NOT ISNULL(GCN_CODE_out_LKP)
the problem is that when the lookup and GCN or NDC code match it's not routing properly
So my question is should I use two different sorters or is there a better way to code this.
Using multiple sorters is not the right option because it reduces the performance. Not sure exactly about your requirement, but I hope below is what you are expecting. Use the condition in router in such a way,
ISNULL(NDC_DRUG_CODE_LOOKUP) AND
NOT ISNULL(NDC_DRUG_CODE_LOOKUP) AND
ISNULL (GCN_CODE_out_LKP) AND
NOT ISNULL(GCN_CODE_out_LKP)
If the condition is not working the issue would be with your lookup. Try creating an output target for each look up and test the scenario.
Try Using Unconnected lookup , Call twice with GCN and NDC , And create four flags in single router and route them as per your requirement ...And one more suggestion if you are using ISNULL in router or any transformation , try to default to some like nvl in oracle, the reason is sometime it takes null both side it does not match..
Hope this helps...

NiFi Lookup Service Error - Failed to Lookup Coordinates in Lookup Service

We keep getting this error when trying to use any Lookup Service (NiFi or 3rd party) to append additional attributes to our initial DB2 Query:
Failed to lookup coordinates {LEGAL_ENTITY_ID_NUM=13366} in Lookup Service
Has anyone had any success merging data from 2 different sql queries based on a common Unique ID from both queries? We've tried LookupRecord which uses Lookup Service, MergeRecord, and MergeContent - nothing seems to work??
Bottom line is - we have an initial main query (ID & Status) - then want to append an additional attribute (Name) from a 2nd query (just contains ID & Name) - onto each record of the main query - after joining on ID.
Whenever we try using LookupRecord, and pass the ID as a parameter via ? marks, we keep getting the above error. We've gotten nowhere with MergeRecord too. We have learned how to MergeContent, but that is not really what we want (is just a workaround).

usage of Aggregator, Group By ports

What happens when we have a port that is a plain pass through, in an aggregator transformation(i.e with out any aggregate function). Please note that, we do have group by ports in the transformation.
I.e in SQL, it is like having a field say 'A' in the select clause with out an aggregate function, but also not added in a group by clause. but there are few field added as a part of Group by. The SQL statement would return an error when trying to execute.
How does the record behave in Informatica in such a case?
Aggregator will pass the value for the last record in the group if you do not use any aggregate function on the column

Informatica lookup: Trying to find input value of output-only port

In an Informatica (9.1.0) mapping, a Lookup Transformation, LKP_TARGET, is derived from a target table, TARGET.
The condition for the Lookup is:
CUST_ID = in_CUST_ID
LKP_TARGET has a port NewLookupRow that is not part of the lookup (is not derived from the target table), has no associated expression, is output-only, and no other port in the lookup has an associated expression that references it. Yet, the output value of this port is in the Groups condition of a Router Transformation.
I am unable to find how this port is getting the value it outputs. Advice is appreciated.
NewLookupRow port is added automatically when you configure a dynamic lookup. Below is the relevant excerpt from Informatica manual.
NewLookupRows
When you configure a Lookup transformation to use a
dynamic cache, the Designer adds the NewLookupRow port to the
transformation. The Integration Service assigns a value to the port,
depending on the action it performs to the lookup cache.
The following table lists the possible NewLookupRow values:
NewLookupRow Value | Description
------------------------------------------------------------------------
0 | Integration Service does not update
| or insert the row in the cache.
1 | Integration Service inserts the row into the cache.
2 | Integration Service updates the row in the cache.
When the Integration Service reads a row, it changes the lookup cache
depending on the results of the lookup query and the Lookup
transformation properties you define. It assigns the value 0, 1, or 2
to the NewLookupRow port to indicate if it inserts or updates the row
in the cache, or makes no change.
The NewLookupRow value indicates how the Integration Service changes
the lookup cache. It does not change the row type. Therefore, use a
Filter or Router transformation and an Update Strategy transformation
to keep the target table and lookup cache synchronized.
Configure the Filter transformation to pass new and updated rows to
the Update Strategy transformation before passing them to the cached
target. Use the Update Strategy transformation to change the row type
of each row to insert or update, depending on the NewLookupRow value.
You can drop the rows that do not change the cache, or you can pass
them to another target.
Define the filter condition in the Filter transformation based on the
value of NewLookupRow. For example, use the following condition to
pass both inserted and updated rows to the cached target:
NewLookupRow != 0

Resources