Presentation is loading. Please wait.

Presentation is loading. Please wait.

SSIS Custom Components Dave

Similar presentations


Presentation on theme: "SSIS Custom Components Dave"— Presentation transcript:

1 SSIS Custom Components Dave Ballantyne dave.ballantyne@live.co.uk @davebally

2 Why ? Provide new functionality not provided as standard

3 Why ? Reusability o Component is a DLL o Single code base o Can be used multiple times in a single project o Can be shared across multiple projects o Easy to test Component version Performance o Faster than scripting Well documenteddocumented o Though not a how-to guide

4 Types Of Component Data Connections Log Providers For Each Loops Control Flow Tasks Data Flow Pipeline Component Custom User Interface

5 Pipeline Component Types Sources Transforms Destinations

6 Design/Run Time Design Time o Work done in BIDS o attachments / detachments o Validation o Column usage Run Time o Metadata interrogation o DTEXEC o Flow of data

7 Demo 1 Reuse and Performance

8 Performance Comparison 100,000500,0001,000,0005,000,00010,000,00020,000,00031,999,680 Custom2619001,6677,86716,37532,85251,426 Script6842,0693,94919,21438,69076,755123,243

9 Requirements Visual Studio – BIDS is not enough Or Visual Basic / C# Express Client Tools SDK

10 Starting Out Target Framework 3.5 (Advanced compile options) Sign the assembley Add References (Program file(x86)/ /100/sdk/Assemblies) o Microsoft.SqlServer.DTSPipelineWrap o Microsoft.SqlServer.DTSRuntimeWrap o Microsoft.SqlServer.ManagedDTS o Microsoft.SqlServer.PipeLine Host

11 Class Creation Inherits PipelineComponent Uses attribute DtsPipelineComponent

12 Post Build Copy DLL to “C:\Program Files (x86)\Microsoft SQL Server\100\DTS\PipelineComponents” Register to Global Assembley Cache using GACUTIL Must Restart BIDS For first use “Choose Items”,”SSIS Data Flow Components”,tick Component

13 MetaData IDTSComponentMetaData 100 PipelineComponent.ComponentMetaData Describes the Component to the engine Inputs, Outputs Custom data held within IDTSCustomProperty100 o Most level s of object

14 MetaData Inputs – IDTSInput100 o Exposed via InputCollection member in MetaData o One instance for each attached input o Contains virtual column collection Accessed with GetVirtualInput() member View of the IDTSOutput100 of the Upstream component IDTSVirtualInputColumn100 o Input Column Collection Accessed with InputColumnCollection Those that are used in the component IDTSInputColumn100 o SetUsageType used to add the virtual column to the input column

15 MetaData Outputs – IDTSOutput100 o Exposed via OutputCollection member in MetaData o One class for each output o output Column Collection Accessed with OutputColumnCollection IDTSOutputColumn100 Dispositions – Errors o Set IsErrorOut on IDTSOutput100

16 Icons Size 16*16 For ToolBox 32*32 For Design Surface Order of “IconResources” is important Build action must be “Embedded Resource”

17 Errors and warnings FireError o At design or run time

18 Errors and warnings FireWarning

19 Design Time Methods Methods o ProvideComponentProperties Define initial metadata of component o Validate Tests the metadata is correct o ReinitializeMetaData Fix the metadata

20 Debug

21 Demo 2 Build a simple component

22 Run-Time Processing Pre-ExecutePrimeOutputProcessInputPostExecute

23 PreExecute Setup the runtime objects Interrogate the Metadata and buffer manager Find the colindex(s) in buffers based on metadata o BufferManager.FindColumnByLineageID(InputId,InputCol.LineageId) PrimeOutput

24 Process Input Loop on buffer.NextRow If buffer.EndOfRowset is true set outputBuffer.SetEndOfRowset() MetaData functions are not optimized for performance.not optimized for performance

25 PipelineBuffer Used for both input and output buffer Get and Set o SetString / GetString o SetInt32 / GetInt32 AddRow o Insert and move to new row SetEndOfRowset o After final row has been poplulated

26 Sync Or Async ? Sync o Add columns to existing data flow o SynchronousInputID of output = ID of input Async o Create new data flow buffer o SynchronousInputID =0

27 Demo 3 RunTime execution

28 User Interface

29

30 A Class that implements IDtsComponentUI Registered to the component class with UITypeName PublicKeyToken is found with GACUTIL

31 User Interface

32 Demo 4 o User interface o UI Code Step Through

33 Conclusion Like SSIS, large learning curve Reusability Potentially Faster ?.Net skills are required

34 SSIS Custom Components Dave Ballantyne dave.ballantyne@live.co.uk @davebally


Download ppt "SSIS Custom Components Dave"

Similar presentations


Ads by Google