• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » tMap to compare text file and mysql table: expression to exclude match

#1 2012-06-27 16:46:51

bronius
Member
Company: BCSWebstudio
Registered: 2009-04-20
Posts: 29
Website

tMap to compare text file and mysql table: expression to exclude match

Hi-

I think my base question is when building a field expression in tMap/java, is the language java or sql?  I have an int field, and I want to test for NULL.  Tried row2.fieldname.isnull(), tried ISNULL(row2.fieldname), etc, can't find a varient that works.

My use case: I have a basic tMap between a text file represented a parsed apache log and mysql table. I am looking for raw POST requests and db records that reflect that the requested values were not honored.  Where my web app apache log looks like:
[date] ... POST /someaction/[nid]/[delta] ...
I have captured into a text file:
nid|delta|date
and I would expect to see that the int nid and int delta have corresponding records in mysql like:
nid|delta|1
where "1" is a positive like a boolean (but stored as int).  But when a match fails, we will still usually get a nid==nid and delta==delta, but the "1" column will be null.  There will be a nid==nid, but delta will be 0 on the mismatched. Happy to go into detail beyond this smile

Here's an example case where my Talend data scrubber here should return a record:
FILE:
12345|1
DB:
12345|0|1
12345|1|NULL
12345|2|NULL
I would like the scrubber to return 12345|1, indicating nid and originally requested nid and delta pair.


It's been a while since I've fired up Talend Open Studio. I am on 4.1 but am downloading 5.1. Either solution will work for me, provided the switch is seamless enough! smile


Uploaded Images

Offline

#2 2012-06-28 04:43:13

bronius
Member
Company: BCSWebstudio
Registered: 2009-04-20
Posts: 29
Website

Re: tMap to compare text file and mysql table: expression to exclude match

Well, short of understanding how to build the expression (actually, I think with row1 as Main and row2 as Lookup, Lookup field expression cannot reference row2.[somefieldname]), I am falling back to doing my basic tMap to join text file and db records and following with a simple filter of looking that the "1" column EQUALS null. See attached.


Uploaded Images

Offline

#3 2012-07-10 01:50:13

alevy
Member
Registered: 2009-11-20
Posts: 1478

Re: tMap to compare text file and mysql table: expression to exclude match

All expressions in Talend are Java, with the sole exception being the statement passed to a DB via t<DB>Input or t<DB>Row.

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » tMap to compare text file and mysql table: expression to exclude match

Board footer

Powered by FluxBB