michelb
07-29-2009, 09:08 AM
Hi, I'm using Kettle (w/ EAX) to generate XML files from our DB.
I've encoutered a situation where I'm not quite sure how to handle in Kettle. We have data like this that I need to insert in one file:
ID VALUE
--------------
ID1 A
ID1 B
ID1 C
ID2 D
ID3 E
ID3 F
...
and I'd like to end up with something like
<root>
<ID1>
<elem>A</elem>
<elem>B</elem>
<elem>C</elem>
</ID1>
<ID2>
<elem>D</elem>
</ID2>
<ID3>
<elem>E</elem>
<elem>F</elem>
</ID3>
...
</root>
(or each ID could be in separate files
file1: <root><ID1> ...</ID1></root>,
file2: <root><ID2>...</ID2></root>, ...)
What's the best way to deal with this? From what I can see the Kettle transforms allow me to deal with data on a 'row by row' method but I don't see a way to fetch more data for the same record (i.e. an obvious method would be to have the transform get all the IDs and then within that transform, fetch each value for that ID and output all that to one file however I don't see a mechanism for pulling more rows for the same record (seems like with 'Table Input', each row is treated separately)).
How can I do this? If one of the samples shows this, please point it out (I looked at what was there but didn't notice anything).
Thanks in advance,
Mike
I've encoutered a situation where I'm not quite sure how to handle in Kettle. We have data like this that I need to insert in one file:
ID VALUE
--------------
ID1 A
ID1 B
ID1 C
ID2 D
ID3 E
ID3 F
...
and I'd like to end up with something like
<root>
<ID1>
<elem>A</elem>
<elem>B</elem>
<elem>C</elem>
</ID1>
<ID2>
<elem>D</elem>
</ID2>
<ID3>
<elem>E</elem>
<elem>F</elem>
</ID3>
...
</root>
(or each ID could be in separate files
file1: <root><ID1> ...</ID1></root>,
file2: <root><ID2>...</ID2></root>, ...)
What's the best way to deal with this? From what I can see the Kettle transforms allow me to deal with data on a 'row by row' method but I don't see a way to fetch more data for the same record (i.e. an obvious method would be to have the transform get all the IDs and then within that transform, fetch each value for that ID and output all that to one file however I don't see a mechanism for pulling more rows for the same record (seems like with 'Table Input', each row is treated separately)).
How can I do this? If one of the samples shows this, please point it out (I looked at what was there but didn't notice anything).
Thanks in advance,
Mike