Reference to preceeding component from custom dataflow transformation component
I am writing a custom dataflow transformation component and I need to get the name of the preceeding component. I have been trying to find a way to get a reference to the Package object, MainPipe object or IDTSPath90 object (connecting to the IDTSInput90 of my component) from my component because I think from there I can get to the information I want. Does anyone have any suggestions? TIA . . . Ed
[448 byte] By [
EdAllan] at [2007-12-19]
When are you trying to do this, design-time I assume.
SP1 Only - For the UI you can now get IDtsPipelineEnvironmentService from the IServiceProvider passed in through IDtsComponentUI.Initialize. This gets you back to the data flow and the task.
I don't think you should be doing this. Basically access to the package and such like outside of your task/component is forbidden in SSIS. This was a deliberate design goal for SSIS to prevent the dynamically changing packages you could write in DTS.
Another point, the name cannot change during execution, so you should do this in PreExecute, not ProcessInput. ProcessInput gets called multiple times during execution, once per buffer, so you should only do row and buffer processing in there. What can be classed as preparatory work like getting your name, or getting column information (columns of course are static during execution) should be done in PreExecute.
Back to the point, there is no way to get to the pipeline hosting your component and since paths are held at that level, I'd say this cannot be done.
Ok - thanks.
Point taken on using PreExecute, that would have been ideal for what I wanted to do.
(I'm writing a custom row count component that writes to an audit object in a user variable. The audit object is built up during package execution then processed (the row counts are summed and validated) and finally serialised and written to the database at OnPostExecute of the package. I wanted the row count component to automatically grab the name of its preceeding component so that it could be saved with the audit data.)
On the question of ProcessInput being executed once per buffer, my understanding is that there will be one buffer per IDTSInputCollection90. Is that correct?
Thanks . . . Ed
Ed Allan wrote: |
| ProcessInput being executed once per buffer, my understanding is that there will be one buffer per IDTSInputCollection90. Is that correct? Thanks . . . Ed |
|
No, that's not my understanding.
IDTSInputCollection is a collection of all the inputs (IDTSInput90) into a component. Most components have only 1 input, some (e.g. MERGE JOIN, UNION ALL) have more.
Each IDTSInput90 will supply many buffers to the component and ProcessInput() is called on each one of those buffers.
-Jamie
I think of the buffer as a tablular structure of a fixed size. The capacity is an amount of memory, and that means you can fix x rows, of y columns. Obviously the number of rows depends on the number and size of columns, the row length. Amongst other things it serves to batch the data as it flows through the pipeline. Starting at a source the buffer is filled with rows. When full that buffer is passed down to the next component (output - path - input). The source then starts filling the next buffer. The following component gets ProcessInput called and is given the first buffer so it can start work, even though the source is still working itself. The pipeline follows a stream patterm, but rather than working at a row level it uses buffers, a collection of rows.
Sorry - I meant IDTSInput90 rather than IDTSInputCollection90.
But my understanding of the buffer was clearly wrong. I've just re-read the documentation and I need to check for buffer.EndOfRowSet.
Thanks for your help . . . Ed