Showing posts with label source. Show all posts
Showing posts with label source. Show all posts

Friday, March 23, 2012

Need Example of Source Component with Multiple non-Error Outputs

Can someone please point me to one or more examples of a Source component that has two or more outputs?

I wrote a source, which works with a single output, but after adding a second output, I see no rows there. I've single-stepped the code in the debugger, and it looks like it should be adding rows to the second output, but the downstream component never sees any.

Thanks.

Synchronous or async?

Here's a synchronous one I wrote a while back:

http://agilebi.com/cs/blogs/jwelch/archive/2007/07/12/processing-a-flat-file-with-header-and-detail-rows.aspx

Here's a different one from Jamie:

http://blogs.conchango.com/jamiethomson/archive/2005/09/05/SSIS-Nugget_3A00_-Multiple-outputs-from-a-synchronous-script-transform.aspx

|||

A source will always be synchronous, by definition. This is a full source component, not a script.

I do not have a suitable sample I can give away, but I can describe it-

Use ProvideComponentProperties to add two outputs, setting ExternalMetadataColumnCollection.IsUsed to true. I also add a custom property as a marker to identify the purpose of each output later on.

Validate and RMD are much the same as usual, do the work that needs doing. PreExecute I use to get the ID of each output and store it in a suitable variable. Same concept as we do with the column index, and we do that too.

In PrimeOutput the array of output ID values can be compared with the ID values you cached in PreExecute. The index in the outputIDs array matches the index in the buffers array, so you can determine which buffer in that array matches which functional output.

Then just add data as normal, add rows and set column values. Do this to each buffer as required.

Finally be sure to call buffer.SetEndOfRowset() on all buffers in the buffers array.

Any help?

|||

Thanks, that's just about what I'm doing, though my (unusual) source doesn't have external metadata. Does it need to?

Like I said, I'm probably doing something silly. I think my next step is to abstract away the specifics of my source. I'll create a source that just returns 10 rows to one output and 10 rows to the other. If that works, then my silly mistake will be in how I send rows to the second output.

Thanks to all.

|||

You do not need it I guess, but it is usual. It acts as a pattern that can be used to describe any external dataset in SSIS terms. We normally work on a model where you can select one or more columns from the external data source, but it does not have o be all. The metadata acts as the choice and output columns are the selection. It also helps for maintenance and validation of columns, because of the separation layer. Still if you had a very stable closed source it may make sense not to bother. I tend to write more flexible components aimed at a wider market, rather than a specific project component.

You send rows to both outputs in exactly the same way, you get multiple buffers in the array, so just add the row to the correct one. That bit the same as havig one buffer, you just need to work out which buffer is which in the array and reference it.

Good luck.

|||

John Saunders wrote:

Like I said, I'm probably doing something silly.

In fact it was so silly, I didn't even realize it. It was bad test data due to having moved from one development environment to the next. I was chaging one file but testing with another file of the same name in a different directory. Very silly.

|||

DarrenSQLIS wrote:

A source will always be synchronous, by definition.

Err...are you sure? I kinda think a source is always asynchronous cos its creating a new execution tree.

-Jamie

sql

Need Example of Source Component with Multiple non-Error Outputs

Can someone please point me to one or more examples of a Source component that has two or more outputs?

I wrote a source, which works with a single output, but after adding a second output, I see no rows there. I've single-stepped the code in the debugger, and it looks like it should be adding rows to the second output, but the downstream component never sees any.

Thanks.

Synchronous or async?

Here's a synchronous one I wrote a while back:

http://agilebi.com/cs/blogs/jwelch/archive/2007/07/12/processing-a-flat-file-with-header-and-detail-rows.aspx

Here's a different one from Jamie:

http://blogs.conchango.com/jamiethomson/archive/2005/09/05/SSIS-Nugget_3A00_-Multiple-outputs-from-a-synchronous-script-transform.aspx

|||

A source will always be synchronous, by definition. This is a full source component, not a script.

I do not have a suitable sample I can give away, but I can describe it-

Use ProvideComponentProperties to add two outputs, setting ExternalMetadataColumnCollection.IsUsed to true. I also add a custom property as a marker to identify the purpose of each output later on.

Validate and RMD are much the same as usual, do the work that needs doing. PreExecute I use to get the ID of each output and store it in a suitable variable. Same concept as we do with the column index, and we do that too.

In PrimeOutput the array of output ID values can be compared with the ID values you cached in PreExecute. The index in the outputIDs array matches the index in the buffers array, so you can determine which buffer in that array matches which functional output.

Then just add data as normal, add rows and set column values. Do this to each buffer as required.

Finally be sure to call buffer.SetEndOfRowset() on all buffers in the buffers array.

Any help?

|||

Thanks, that's just about what I'm doing, though my (unusual) source doesn't have external metadata. Does it need to?

Like I said, I'm probably doing something silly. I think my next step is to abstract away the specifics of my source. I'll create a source that just returns 10 rows to one output and 10 rows to the other. If that works, then my silly mistake will be in how I send rows to the second output.

Thanks to all.

|||

You do not need it I guess, but it is usual. It acts as a pattern that can be used to describe any external dataset in SSIS terms. We normally work on a model where you can select one or more columns from the external data source, but it does not have o be all. The metadata acts as the choice and output columns are the selection. It also helps for maintenance and validation of columns, because of the separation layer. Still if you had a very stable closed source it may make sense not to bother. I tend to write more flexible components aimed at a wider market, rather than a specific project component.

You send rows to both outputs in exactly the same way, you get multiple buffers in the array, so just add the row to the correct one. That bit the same as havig one buffer, you just need to work out which buffer is which in the array and reference it.

Good luck.

|||

John Saunders wrote:

Like I said, I'm probably doing something silly.

In fact it was so silly, I didn't even realize it. It was bad test data due to having moved from one development environment to the next. I was chaging one file but testing with another file of the same name in a different directory. Very silly.

|||

DarrenSQLIS wrote:

A source will always be synchronous, by definition.

Err...are you sure? I kinda think a source is always asynchronous cos its creating a new execution tree.

-Jamie

Wednesday, March 21, 2012

Need assistance with Data Flow Task error - please help

I am trying to execute a Data Flow Task. There is only one task in the data flow task so far, and that is a Flat File Source task. I also set up a Connection Manager for the file, myfile.txt.

When I try to run the Data Flow Task, I get these errors:

The first problem seems to be with the connection, on the first line. What connection element is missing here? The others seem to be truncation errors. I don't know why that is. I changed the column sizes to match the sizes of database columns. They ARE surrounded by double-quotes, but I have {"} specified as a Text Qualifier in my Connection Manager.

Please, need help!


Error: 0xC001000E at : The connection "{F6513CB9-29E2-4D88-A86B-0EF9DFABE9D6}" is not found. This error is thrown by Connections collection when the specific connection element is not found.
SSIS package "MyPackage.dtsx" starting.
Information: 0x4004300A at Data Flow Task, DTS.Pipeline: Validation phase is beginning.

Information: 0x40043006 at Data Flow Task, DTS.Pipeline: Prepare for Execute phase is beginning.
Information: 0x40043007 at Data Flow Task, DTS.Pipeline: Pre-Execute phase is beginning.
Information: 0x402090DC at Data Flow Task, Flat File Source [2168]: The processing of file "D:\myfile.txt" has started.
Information: 0x4004300C at Data Flow Task, DTS.Pipeline: Execute phase is beginning.
Error: 0xC02020A1 at Data Flow Task, Flat File Source [2168]: Data conversion failed. The data conversion for column "Column 0" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page.".
Error: 0xC020902A at Data Flow Task, Flat File Source [2168]: The "output column "Column 0" (2185)" failed because truncation occurred, and the truncation row disposition on "output column "Column 0" (2185)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.
Error: 0xC0202092 at Data Flow Task, Flat File Source [2168]: An error occurred while processing file "D:\myfile.txt" on data row 1.
Error: 0xC0047038 at Data Flow Task, DTS.Pipeline: The PrimeOutput method on component "Flat File Source" (2168) returned error code 0xC0202092. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.
Error: 0xC0047021 at Data Flow Task, DTS.Pipeline: Thread "SourceThread0" has exited with error code 0xC0047038.
Information: 0x40043008 at Data Flow Task, DTS.Pipeline: Post Execute phase is beginning.
Information: 0x402090DD at Data Flow Task, Flat File Source [2168]: The processing of file "D:\myfile.txt" has ended.
Information: 0x40043009 at Data Flow Task, DTS.Pipeline: Cleanup phase is beginning.
Task failed: Data Flow Task

One of the error messages indicates that the Flat File source will fail when the data in column 0 is truncated. Have you tried setting the source to not fail when data is truncated?

1. Right-click the Flat File Source component on the Data Flow tab in SSIS, and then click Edit.

2. Click Error Output in the left-hand pane.

3. In the Truncation drop-down list, select Ignore failure.

4. Click OK.

Also, if you're configuring the Flat File Connection Manager to use a specified code page (see Error 0xC02020A1 above), try configuring the Connection Manager for Unicode:

1. Right-click the Flat File Connection Manager, and then click Edit.

2. Select the Unicode checkbox.

|||

Actually i was having the same rpoblem and i was playing with diferent options.

Go to your Flat File Source in Connection Manager

Go to Advanced and verify outputColumn width and match with your table datatype / the size of data you have it on file

make it sure you donot want to ignore the data just becasue of some errors .

Satish Shrikhande

satish_isi@.hotmail.com

|||Yeah, also watch out for NULL (hex 00) characters in your string fields. NULLs terminate DT_STR and DT_WSTR data types -- even if there is more data after the NULL character.

Need assistance with Data Flow Task error - please help

I am trying to execute a Data Flow Task. There is only one task in the data flow task so far, and that is a Flat File Source task. I also set up a Connection Manager for the file, myfile.txt.

When I try to run the Data Flow Task, I get these errors:

The first problem seems to be with the connection, on the first line. What connection element is missing here? The others seem to be truncation errors. I don't know why that is. I changed the column sizes to match the sizes of database columns. They ARE surrounded by double-quotes, but I have {"} specified as a Text Qualifier in my Connection Manager.

Please, need help!


Error: 0xC001000E at : The connection "{F6513CB9-29E2-4D88-A86B-0EF9DFABE9D6}" is not found. This error is thrown by Connections collection when the specific connection element is not found.
SSIS package "MyPackage.dtsx" starting.
Information: 0x4004300A at Data Flow Task, DTS.Pipeline: Validation phase is beginning.

Information: 0x40043006 at Data Flow Task, DTS.Pipeline: Prepare for Execute phase is beginning.
Information: 0x40043007 at Data Flow Task, DTS.Pipeline: Pre-Execute phase is beginning.
Information: 0x402090DC at Data Flow Task, Flat File Source [2168]: The processing of file "D:\myfile.txt" has started.
Information: 0x4004300C at Data Flow Task, DTS.Pipeline: Execute phase is beginning.
Error: 0xC02020A1 at Data Flow Task, Flat File Source [2168]: Data conversion failed. The data conversion for column "Column 0" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page.".
Error: 0xC020902A at Data Flow Task, Flat File Source [2168]: The "output column "Column 0" (2185)" failed because truncation occurred, and the truncation row disposition on "output column "Column 0" (2185)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.
Error: 0xC0202092 at Data Flow Task, Flat File Source [2168]: An error occurred while processing file "D:\myfile.txt" on data row 1.
Error: 0xC0047038 at Data Flow Task, DTS.Pipeline: The PrimeOutput method on component "Flat File Source" (2168) returned error code 0xC0202092. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.
Error: 0xC0047021 at Data Flow Task, DTS.Pipeline: Thread "SourceThread0" has exited with error code 0xC0047038.
Information: 0x40043008 at Data Flow Task, DTS.Pipeline: Post Execute phase is beginning.
Information: 0x402090DD at Data Flow Task, Flat File Source [2168]: The processing of file "D:\myfile.txt" has ended.
Information: 0x40043009 at Data Flow Task, DTS.Pipeline: Cleanup phase is beginning.
Task failed: Data Flow Task

One of the error messages indicates that the Flat File source will fail when the data in column 0 is truncated. Have you tried setting the source to not fail when data is truncated?

1. Right-click the Flat File Source component on the Data Flow tab in SSIS, and then click Edit.

2. Click Error Output in the left-hand pane.

3. In the Truncation drop-down list, select Ignore failure.

4. Click OK.

Also, if you're configuring the Flat File Connection Manager to use a specified code page (see Error 0xC02020A1 above), try configuring the Connection Manager for Unicode:

1. Right-click the Flat File Connection Manager, and then click Edit.

2. Select the Unicode checkbox.

|||

Actually i was having the same rpoblem and i was playing with diferent options.

Go to your Flat File Source in Connection Manager

Go to Advanced and verify outputColumn width and match with your table datatype / the size of data you have it on file

make it sure you donot want to ignore the data just becasue of some errors .

Satish Shrikhande

satish_isi@.hotmail.com

|||Yeah, also watch out for NULL (hex 00) characters in your string fields. NULLs terminate DT_STR and DT_WSTR data types -- even if there is more data after the NULL character.