72
Don't Repeat Yourself - Agile SSIS development with Biml and BimlScript Cathrine Wilhelmsen SQL Server Days 2015

Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Embed Size (px)

Citation preview

Page 1: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Don't Repeat Yourself -Agile SSIS development with Biml and BimlScript

Cathrine WilhelmsenSQL Server Days 2015

Page 2: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

SQL Server Days would like to thank all of our sponsors!

Page 3: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Session Description

Page 4: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Cathrine Wilhelmsen

@cathrinew

cathrinewilhelmsen.netData Warehouse Architect

Business Intelligence Developer

Page 5: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Who are you? *

( * Probably not a cat)

Page 6: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Your work day?

(Drag, drop, drag, drop, connect, drag, drop, connect,

resize, align, drag, drop, resize, connect, align…)

Page 7: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

job done!

new standards

...yay

Ever experienced this?

Page 8: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Ready for a change?

Page 9: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

From Traditional SSIS to Agile SSIS

Page 10: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Traditional SSIS: Plumbing

Page 11: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Agile SSIS: Business Logic

Page 12: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)
Page 13: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Will Biml solve all your problems?

Page 14: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

How can Biml help you?

Page 15: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

What is Business Intelligence Markup Language?

Page 16: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

What do you need?

Page 17: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

...or you can invest in

Page 18: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

How does it work?

Page 19: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

<Biml xmlns="http://schemas.varigence.com/biml.xsd"><Packages>

<Package Name="EmptyPackage1"></Package>

<Package Name="EmptyPackage2"/>

</Packages>

</Biml>

Biml syntax

Page 20: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

<Biml xmlns="http://schemas.varigence.com/biml.xsd"><Packages>

<Package Name="EmptyPackage1"></Package>

<Package Name="EmptyPackage2"/>

</Packages>

</Biml>

Biml syntax: Root Element

Page 21: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

<Biml xmlns="http://schemas.varigence.com/biml.xsd"><Packages>

<Package Name="EmptyPackage1"></Package>

<Package Name="EmptyPackage2"/>

</Packages>

</Biml>

Biml syntax: Collection of Elements

Page 22: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

<Biml xmlns="http://schemas.varigence.com/biml.xsd"><Packages>

<Package Name="EmptyPackage1"></Package>

<Package Name="EmptyPackage2"/>

</Packages>

</Biml>

Biml syntax: Elements

Page 23: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

<Biml xmlns="http://schemas.varigence.com/biml.xsd"><Packages>

<Package Name="EmptyPackage1"></Package>

<Package Name="EmptyPackage2"/>

</Packages>

</Biml>

Biml syntax: Attributes

Page 24: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

<Biml xmlns="http://schemas.varigence.com/biml.xsd"><Packages>

<Package Name="EmptyPackage1"></Package>

<Package Name="EmptyPackage2"/>

</Packages>

</Biml>

Biml syntax: Full vs. Shorthand Syntax

Page 25: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Let's generate some packages

Page 26: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Right-click on SSIS project and click Add New Biml File

Page 27: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Biml files are placed in the Miscellaneous folder

<Biml xmlns="http://schemas.varigence.com/biml.xsd">

<Packages>

<Package Name="EmptyPackage1"></Package>

<Package Name="EmptyPackage2"/>

</Packages>

</Biml>

Page 28: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Right-click on the Biml file to Generate SSIS Packages

<Biml xmlns="http://schemas.varigence.com/biml.xsd">

<Packages>

<Package Name="EmptyPackage1"></Package>

<Package Name="EmptyPackage2"/>

</Packages>

</Biml>

Page 29: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

From Biml to SSIS

Page 30: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

From Biml to SSIS

Page 31: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

.biml vs .dtsx: human-readable vs ALL THE CODE!

(150% zoom) (20% zoom)

Page 32: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

I create SSIS packages faster than that

Page 33: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

But wait!

Page 34: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

The magic is in the

Page 35: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Import

Loop

Add expressions

What is ?

Page 36: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

BimlScript code blocks

<#@ … #>

<# … #>

<#= … #>

<#+ … #>

Page 37: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

<Biml xmlns="http://schemas.varigence.com/biml.xsd">

<Packages>

<# foreach (var table in RootNode.Tables) { #>

<Package Name="Load<#=table.Name#>"></Package>

<# } #>

</Packages>

</Biml>

BimlScript syntax

Page 38: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

<Biml xmlns="http://schemas.varigence.com/biml.xsd">

<Packages>

<# foreach (var table in RootNode.Tables) { #>

<Package Name="Load<#=table.Name#>"></Package>

<# } #>

</Packages>

</Biml>

BimlScript syntax: Control Blocks

Page 39: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

<Biml xmlns="http://schemas.varigence.com/biml.xsd">

<Packages>

<# foreach (var table in RootNode.Tables) { #>

<Package Name="Load<#=table.Name#>"></Package>

<# } #>

</Packages>

</Biml>

BimlScript syntax: Expression Control Block

Page 40: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

How does it work?

Page 41: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Yes, but how does it work?

41

Page 42: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Yes, but how does it actually work?<Biml xmlns="http://schemas.varigence.com/biml.xsd">

<Packages>

<# foreach (var table in RootNode.Tables) { #>

<Package Name="Load<#=table.Name#>"></Package>

<# } #>

</Packages>

</Biml>

<Biml xmlns="http://schemas.varigence.com/biml.xsd">

<Packages>

<Package Name="LoadCustomer"></Package>

<Package Name="LoadProduct"></Package>

<Package Name="LoadSales"></Package>

</Packages>

</Biml>

Page 43: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Don't Repeat Yourself

Page 44: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Don't Repeat Yourself

Page 45: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Don't Repeat Yourself

Page 46: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

<#@ template tier="1" #>

Don't Repeat Yourself: Split and combine Biml files

Page 47: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Split and combine multiple Biml files

1

2

3

Page 48: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

<#@ include file="CommonCode.biml" #>

Don't Repeat Yourself: Include files

Page 49: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Don't Repeat Yourself: Include files

Page 50: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Don't Repeat Yourself: Include files

Page 51: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Don't Repeat Yourself: Include files

Page 52: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

<#@ property name="Table" type="AstTableNode" #>

<#=CallBimlScript("CommonCode.biml", Table)#>

Don't Repeat Yourself: CallBimlScript with parameters

Page 53: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Don't Repeat Yourself: CallBimlScript with parameters

Page 54: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Don't Repeat Yourself: CallBimlScript with parameters

Page 55: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Don't Repeat Yourself: CallBimlScript with parameters

Page 56: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Don't Repeat Yourself: CallBimlScript with parameters

Page 57: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Don't Repeat Yourself: CallBimlScript with parameters

Page 58: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

C# Classes and Methods

Page 59: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

<#+

public class HelperClass {

public static string HelperMethod(string InputParameter) {

return string.Concat("InputParameter: ", InputParameter);

}

}

#>

C# Classes and Methods

Page 60: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

<Biml xmlns="http://schemas.varigence.com/biml.xsd">

<#=HelperClass.HelperMethod("Cats")#>

</Biml>

<#+

public class HelperClass {

public static string HelperMethod(string InputParameter) {

return string.Concat("InputParameter: ", InputParameter);

}

}

#>

C# Classes and Methods: Inline

Page 61: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

<#@ include file="HelperClass.biml" #>

<Biml xmlns="http://schemas.varigence.com/biml.xsd">

<#=HelperClass.HelperMethod("Cats")#>

</Biml>

C# Classes and Methods: Included

<#+public class HelperClass {

public static string HelperMethod(string InputParameter) {return string.Concat("InputParameter: ", InputParameter);

}}

#>

Page 62: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

<#@ code file="..\Code\HelperClass.cs" #>

<Biml xmlns="http://schemas.varigence.com/biml.xsd">

<#=HelperClass.HelperMethod("Cats")#>

</Biml>

C# Classes and Methods: Mist / BimlStudio

using System.Data;

public class HelperClass {public static string HelperMethod(string InputParameter) {return string.Concat("InputParameter: ", InputParameter);

}}

Page 63: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Transformers(No, not those transformers, but still awesome!)

Page 64: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Transformers: Modify existing Biml

Page 65: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

<#@ target type="Package" mergemode="LocalMerge" #>

<!–- <Node> = Target Type = <Package> -->

<Node>

<Variables>

<Variable Name="NewRows" DataType="Int32">0</Variable>

</Variables>

</Node>

Transformers syntax

Page 66: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

<#@ target type="Package" mergemode="LocalMerge" #>

<!–- <Node> = Target Type = <Package> -->

<Node>

<Variables>

<Variable Name="NewRows" DataType="Int32">0</Variable>

</Variables>

</Node>

Transformers syntax: Target Type

Page 67: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

<#@ target type="Package" mergemode="LocalMerge" #>

<!–- <Node> = Target Type = <Package> -->

<Node>

<Variables>

<Variable Name="NewRows" DataType="Int32">0</Variable>

</Variables>

</Node>

Transformers syntax: Merge Mode

Page 68: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Demo

Page 69: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

GET THINGS DONE KEEP GOING

Page 70: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

What do you do next?

Page 71: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

Biml on Monday...

Page 72: Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL Server Days)

@cathrinew

cathrinewilhelmsen.net

no.linkedin.com/in/cathrinewilhelmsen

[email protected]

slideshare.net/cathrinewilhelmsen

Biml resources and references:

cathrinewilhelmsen.net/biml