Hi,
Scenario
I’m comparing the row counts from two different tables and if the difference is >0 or <0 then I would like to fail/abort the job and send notification to email.
Waiting for direction.
Thanks,
BS
Hi,
Scenario
I’m comparing the row counts from two different tables and if the difference is >0 or <0 then I would like to fail/abort the job and send notification to email.
Waiting for direction.
Thanks,
BS
Hi @santosh.b.biradar and thanks for your question!
There's a few options for this. For one, you could use a Jython or a QueryResultToScalar component.
For the Jython component, the code would be something like the below:
cursor = context.cursor()
cursor.execute('select count(*) from "your first table"')
firstcount = cursor.fetchone()[0]
cursor.execute('select count(*) from "your second table"')
secondcount = cursor.fetchone()[0]assert firstcount == secondcount, "Wanted equal counts from tables but got " + firstcount + " != " + secondcount
I'm sure that there are other members of the community that could give you further suggestions as well. Let us know how you get on!
Many thanks,
Claire