Adding EL support to UpdateAttribute for the Attribute Name

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Adding EL support to UpdateAttribute for the Attribute Name

Peter Wicks (pwicks)
I've run into a use case for adding EL support into the Attribute Name itself in UpdateAttribute. Looking for thoughts on other approaches, pros/cons of doing this.

I'm generically extracting data from a database. Right now I have ~30 tables, but that number could be anything, just think big enough to be a pain to put into RouteOnAttribute and handle individually. Each table has a varying number of columns. In my destination system I have some trailing metadata columns in the tables about when the data was loaded, what the FlowFile UUID was, etc... I provide the values for these columns using UpdateAttribute and providing a value. As part of my extraction code I've tacked on the column count as an attribute so that I know my metadata columns are ${fieldcount} + 1, +2, +3, etc...

Now my downstream processors are expecting a sql.args.##.value attribute for loading the data. Unfortunately, the column number for these trailing columns shifts from table to table. I'm experimenting with allowing UpdateAttribute to evaluate EL, where the Attribute Name might be: "sql.args.${fieldcount}.value".