SlideShare a Scribd company logo
Biml for Beginners:
Generating SSIS packages with BimlScript
Cathrine Wilhelmsen
September 5th 2015
Session description
SSIS is a powerful tool for extracting, transforming and loading data,
but creating the actual SSIS packages can be both tedious and time-
consuming. Even if you use templates and follow best practices you
often have to repeat the same steps over and over again. There are
no easy ways to handle metadata and schema changes, and if there
are new requirements you might have to go through all the packages
one more time. It's time to bring the Don't Repeat Yourself principle
to SSIS development.
In this session I will use the free BIDS Helper add-in to show you the
basics of Biml and BimlScript, how to generate SSIS packages
automatically from databases, how easy those packages can be
changed, and how to move common code to separate files that can
be included where needed. See why they say Biml allows you to
complete in a day what once took more than a week!
@cathrinew
cathrinewilhelmsen.net
Data Warehouse Architect
Business Intelligence Developer
Cathrine Wilhelmsen
Who are you? (*)
SSIS and ETL Developer?
Easily bored?
Tired of repetitive work?
( * Probably not a cat )
Why are you here?
Long development time?
Many SSIS packages?
Slow GUI editor?
(Drag, drop, drag, drop, connect,
drag, drop, connect, resize, align,
drag, drop, resize, connect, align…)
job done!
new standards
yay
Have you ever experienced this?
Ready for a change?
Business Intelligence Markup Language
Easy to read and write XML dialect
Specifies business intelligence objects
Databases, schemas, tables, columns
SSIS packages
SSAS cubes, facts, dimensions (Mist only)
Highlights in Biml History
founded by Scott Currie, is born
Biml was extended with
Biml compiler added to
is launched
founded
is launched
2008:
2009:
2011:
2012:
2014:
2015:
How can Biml help you?
Timesaving: Many SSIS
Packages from one Biml file
Reusable: Write once and run
on any platform (2005 – 2014)
Flexible: Start simple, expand
as you learn
(Of course I can create 200 packages!
What do you need me to do after lunch?)
What do you need?
How does it work?
Generated packages are indistinguishable from manually created packages
Biml syntax
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Packages>
<Package Name="EmptyPackage1"></Package>
<Package Name="EmptyPackage2"/>
</Packages>
</Biml>
Biml syntax: Root Element
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Packages>
<Package Name="EmptyPackage1"></Package>
<Package Name="EmptyPackage2"/>
</Packages>
</Biml>
Biml syntax: Collection of Elements
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Packages>
<Package Name="EmptyPackage1"></Package>
<Package Name="EmptyPackage2"/>
</Packages>
</Biml>
Biml syntax: Elements
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Packages>
<Package Name="EmptyPackage1"></Package>
<Package Name="EmptyPackage2"/>
</Packages>
</Biml>
Biml syntax: Attributes
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Packages>
<Package Name="EmptyPackage1"></Package>
<Package Name="EmptyPackage2"/>
</Packages>
</Biml>
Biml syntax: Full vs. Shorthand Syntax
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Packages>
<Package Name="EmptyPackage1"></Package>
<Package Name="EmptyPackage2"/>
</Packages>
</Biml>
Demo – Biml
Getting started with Biml
1. Download and install BIDS Helper (http://bidshelper.codeplex.com)
2. Right-click on SSIS project and click Add New Biml File
Intellisense
Intellisense while typing
CTRL+Space to AutoComplete or show Intellisense
Errors
Red squiggly line: Error
Blue squiggly line: Missing attribute or child element
Error spelling
Missing attribute: ConstraintMode
Errors
Hovering over errors will show descriptive text
Missing attribute: ConstraintMode
Error spelling
Right-click to Check Biml for Errors
Your first SSIS Package from Biml
Right-click on Biml file and click Generate SSIS Packages
Packages will appear under SSIS Packages
From Biml to SSIS
From Biml to SSIS
.biml vs .dtsx:
human-readable vs ALL THE CODE!
(150% zoom) (20% zoom)
I create SSIS packages faster than that
But wait!
The magic is in the
Extend Biml with C# or VB.NET code blocks
Import database structure and metadata
Loop over tables and columns
Add expressions to replace static values
Allows you to control and manipulate Biml code
BimlScript code blocks
<#@ … #> Directives (Instructions to the BimlCompiler)
<# … #> Control Blocks (Control logic)
<#= … #> Expression Control Blocks (Replace block with string value)
<#+ … #> Class Feature Control Blocks (Create helper methods)
BimlScript syntax
<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
<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
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Packages>
<# foreach (var table in RootNode.Tables) { #>
<Package Name="Load<#=table.Name#>"></Package>
<# } #>
</Packages>
</Biml>
How does it work?
Yes, but how does it work?
37
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>
Demo – BimlScript
Basic for loop
<Packages>
<# for (int count = 1; count <= 5; count++) { #>
<Package Name="Load_Person_Person_<#=count#>">
</Package>
<# } #>
</Packages>
foreach (table in a database) loop
<#@ import namespace="Varigence.Hadron.CoreLowerer.SchemaManagement" #>
<# var conAW2014 = SchemaManager.CreateConnectionNode("AW2014", "Data Source...");
#>
<# var AW2014DB = conAW2014.ImportDB("","", ImportOptions.ExcludeViews); #>
<Packages>
<# foreach (var table in AW2014DB.TableNodes) { #>
<Package Name="Load_<#=table.Schema#>_<#=table.Name#>">
</Package>
<# } #>
</Packages>
Don't Repeat Yourself
Move common code to separate files
Centralize and reuse in many projects
Update code once for all projects
1. Split and combine Biml files
2. Include files
3. CallBimlScript with parameters
Split and combine Biml files
Solve logical dependencies and simulate manual workflows by using tiers
Tiers instruct the BimlCompiler to compile files from lowest to highest tier
<#@ template tier="1" #>
Higher tiers can use and might depend on objects from lower tiers
Tier 1 - Create database connections
Example: Tier 2 - Create loading packages
Tier 3 - Create master package to execute loading packages
Split and combine Biml files
1. Create Biml files with specified tiers
2. Select all the tiered Biml files
3. Right-click and click Generate SSIS Packages
1
2
3
Behind the scenes: Split and combine Biml files
RootNode
<#@ template tier="0" #>
<Connections>
<Databases>
<Schemas>
<#@ template tier="1" #>
<Tables>
<Columns>
<#@ template tier="2" #>
<Packages>
<Connections>
<Databases>
<Schemas>RootNode
<#@ template tier="0" #>
<Connections>
<Databases>
<Schemas>
<#@ template tier="1" #>
<Tables>
<Columns>
<#@ template tier="2" #>
<Packages>
compile
Behind the scenes: Split and combine Biml files
<Connections>
<Databases>
<Schemas>RootNode
<#@ template tier="0" #>
<Connections>
<Databases>
<Schemas>
<#@ template tier="1" #>
<Tables>
<Columns>
<#@ template tier="2" #>
<Packages>
use
Behind the scenes: Split and combine Biml files
<Connections>
<Databases>
<Schemas>
<Tables>
<Columns>
RootNode
<#@ template tier="0" #>
<Connections>
<Databases>
<Schemas>
<#@ template tier="1" #>
<Tables>
<Columns>
<#@ template tier="2" #>
<Packages>
compile
Behind the scenes: Split and combine Biml files
<Connections>
<Databases>
<Schemas>
<Tables>
<Columns>
RootNode
<#@ template tier="0" #>
<Connections>
<Databases>
<Schemas>
<#@ template tier="1" #>
<Tables>
<Columns>
<#@ template tier="2" #>
<Packages> use
Behind the scenes: Split and combine Biml files
<Connections>
<Databases>
<Schemas>
<Tables>
<Columns>
<Packages>
RootNode
<#@ template tier="0" #>
<Connections>
<Databases>
<Schemas>
<#@ template tier="1" #>
<Tables>
<Columns>
<#@ template tier="2" #>
<Packages> compile
Behind the scenes: Split and combine Biml files
<Connections>
<Databases>
<Schemas>
<Tables>
<Columns>
<Packages>
RootNode
<#@ template tier="0" #>
<Connections>
<Databases>
<Schemas>
<#@ template tier="1" #>
<Tables>
<Columns>
<#@ template tier="2" #>
<Packages>
generate
Behind the scenes: Split and combine Biml files
RootNode
<#@ template tier="0" #>
<Connections>
<Databases>
<Schemas>
<#@ template tier="1" #>
<Tables>
<Columns>
<#@ template tier="2" #>
<Packages>
Behind the scenes: Split and combine Biml files
Don't Repeat Yourself: Include files
Include common code in multiple files and projects
Can include many file types: .biml .txt .sql .cs
Use the include directive
<#@ include file="CommonCode.biml" #>
The include directive will be replaced by the content of the included file
Include pulls code from the included file into the main file
Don't Repeat Yourself: Include files
Don't Repeat Yourself: CallBimlScript with parameters
Works like a parameterized include
File to be called (callee) specifies the input parameters it accepts
<#@ property name="Table" type="AstTableNode" #>
File that calls (caller) passes input parameters
<#=CallBimlScript("CommonCode.biml", Table)#>
CallBimlScript pushes parameters from the caller to the callee, and the
callee returns code
Don't Repeat Yourself: CallBimlScript with parameters
Don't Repeat Yourself: CallBimlScript with parameters
Demo
View compiled Biml
Credits: Marco Schreuder (@in2bi)
http://blog.in2bi.eu/biml/viewing-or-saving-the-
compiled-biml-file-s/
Helper file with high tier (tier="100")
Saves output of RootNode.GetBiml() to file
What do you do next?
1. Download BIDS Helper
2. Identify your SSIS patterns
3. Rewrite one SSIS package to Biml to learn the basics
4. Expand with BimlScript
5. Get involved in the Biml community
Biml on Monday...
…BimlBreak the rest of the week 
More Biml!
Don't miss Rasmus Reinholdt's session
Building a meta-driven near realtime
ETL solution with BIML and SSIS
at 14:55!
…and come chat with us in the breaks 
Thank you! 
@cathrinew
cathrinewilhelmsen.net
no.linkedin.com/in/cathrinewilhelmsen
contact@cathrinewilhelmsen.net
cathrinewilhelmsen.net/biml
slideshare.net/cathrinewilhelmsenBiml resources
over there!

More Related Content

PDF
Upgrading from SSIS Package Deployment to Project Deployment (SQLSaturday Den...
PDF
Biml for Beginners: Speed up your SSIS development (SQLSaturday Chicago)
PDF
Biml for Beginners: Speed up your SSIS development (SQLSaturday Iceland)
PDF
Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL ...
PDF
S.M.A.R.T. Biml - Standardize, Model, Automate, Reuse and Transform (SQLSatur...
PDF
Biml for Beginners - Generating SSIS Packages with BimlScript (SQLSaturday Ex...
PDF
Biml Academy 2 - Lesson 5: Importing source metadata into Biml
PDF
Level Up Your Biml: Best Practices and Coding Techniques (SQLSaturday Sacrame...
Upgrading from SSIS Package Deployment to Project Deployment (SQLSaturday Den...
Biml for Beginners: Speed up your SSIS development (SQLSaturday Chicago)
Biml for Beginners: Speed up your SSIS development (SQLSaturday Iceland)
Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL ...
S.M.A.R.T. Biml - Standardize, Model, Automate, Reuse and Transform (SQLSatur...
Biml for Beginners - Generating SSIS Packages with BimlScript (SQLSaturday Ex...
Biml Academy 2 - Lesson 5: Importing source metadata into Biml
Level Up Your Biml: Best Practices and Coding Techniques (SQLSaturday Sacrame...

What's hot (20)

PDF
Don't Repeat Yourself - An Introduction to Agile SSIS Development (24 Hours o...
PDF
Level Up Your Biml: Best Practices and Coding Techniques (NTK 2016)
PDF
Generate SSIS packages automatically with Biml and BimlScript (SQLKonferenz 2...
PDF
Level Up Your Biml: Best Practices and Coding Techniques (SQLSaturday Oslo)
PDF
Level Up Your Biml: Best Practices and Coding Techniques (TUGA IT 2016)
PDF
Level Up Your Biml: Best Practices and Coding Techniques (SQLSaturday Minnesota)
PDF
Level Up Your Biml: Best Practices and Coding Techniques (SQLSaturday Denver)
PDF
Biml for Beginners: Speed up your SSIS development (SQLSaturday Vienna)
PDF
Biml for Beginners: Speed up your SSIS development (SQLSaturday Vancouver)
PDF
Biml for Beginners: Speed up your SSIS development (Malta Microsoft Data Plat...
PDF
Tools and Tips: From Accidental to Efficient Data Warehouse Developer (SQLSat...
PDF
Marty, You're Just Not Thinking Fourth Dimensionally
PPTX
Sql bits creating a meta data driven ssis solution with biml
PDF
XPages and jQuery DataTables: Simplifying View Creation while Maximizing Func...
PPTX
Liquibase migration for data bases
PPTX
The Grid the Brad and the Ugly: Using Grids to Improve Your Applications
KEY
Agile Database Development with Liquibase
PPTX
Introduction to MongoDB
PPTX
Piecing Together the WordPress Puzzle
PDF
XPages Blast - Lotusphere 2013
Don't Repeat Yourself - An Introduction to Agile SSIS Development (24 Hours o...
Level Up Your Biml: Best Practices and Coding Techniques (NTK 2016)
Generate SSIS packages automatically with Biml and BimlScript (SQLKonferenz 2...
Level Up Your Biml: Best Practices and Coding Techniques (SQLSaturday Oslo)
Level Up Your Biml: Best Practices and Coding Techniques (TUGA IT 2016)
Level Up Your Biml: Best Practices and Coding Techniques (SQLSaturday Minnesota)
Level Up Your Biml: Best Practices and Coding Techniques (SQLSaturday Denver)
Biml for Beginners: Speed up your SSIS development (SQLSaturday Vienna)
Biml for Beginners: Speed up your SSIS development (SQLSaturday Vancouver)
Biml for Beginners: Speed up your SSIS development (Malta Microsoft Data Plat...
Tools and Tips: From Accidental to Efficient Data Warehouse Developer (SQLSat...
Marty, You're Just Not Thinking Fourth Dimensionally
Sql bits creating a meta data driven ssis solution with biml
XPages and jQuery DataTables: Simplifying View Creation while Maximizing Func...
Liquibase migration for data bases
The Grid the Brad and the Ugly: Using Grids to Improve Your Applications
Agile Database Development with Liquibase
Introduction to MongoDB
Piecing Together the WordPress Puzzle
XPages Blast - Lotusphere 2013
Ad

Similar to Biml for Beginners - Generating SSIS Packages with BimlScript (SQLSaturday Gothenburg) (20)

PDF
Biml for Beginners: Speed up your SSIS development (SQLBits XV)
PDF
Biml for Beginners: Script and Automate SSIS development (Hybrid VC)
PDF
Biml for Beginners: Speed up your SSIS development (SQLSaturday Tallinn)
PDF
Biml for Beginners: Script and Automate SSIS development (Capital Area SQL Se...
PDF
Biml for Beginners: Script and Automate SSIS development (Malibu SQL Server U...
PDF
Biml for Beginners: Script and Automate SSIS development (SQLSaturday Chicago)
PDF
Biml for Beginners: Script and Automate SSIS development (24 Hours of PASS: S...
PDF
Biml for Beginners: Script and Automate SSIS development (SQLSaturday Oslo)
PDF
Biml for Beginners: Speed up your SSIS development (SQLSaturday Nashville)
PDF
Biml for Beginners: Speed up your SSIS development (SQL PASS Edmonton )
PDF
Biml for Beginners: Script and Automate SSIS development (SQLSaturday Finland)
PDF
Level Up Your Biml: Best Practices and Coding Techniques (SQLBits 2018)
PPTX
BIML: BI to the next level
PDF
Level Up Your Biml: Best Practices and Coding Techniques (PASS Summit 2018)
PDF
Biml Tips and Tricks: Not Just for SSIS Packages! (SQLGrillen 2018)
PDF
Level Up Your Biml: Best Practices and Coding Techniques (SQLDay 2018)
PDF
Tools and Tips: From Accidental to Efficient Data Warehouse Developer (SQLBit...
PPTX
BIML- What is it good for?
PDF
BI xPress - Pragmatic Works
PDF
A hands-on-guide-for-working-with-mapplets
Biml for Beginners: Speed up your SSIS development (SQLBits XV)
Biml for Beginners: Script and Automate SSIS development (Hybrid VC)
Biml for Beginners: Speed up your SSIS development (SQLSaturday Tallinn)
Biml for Beginners: Script and Automate SSIS development (Capital Area SQL Se...
Biml for Beginners: Script and Automate SSIS development (Malibu SQL Server U...
Biml for Beginners: Script and Automate SSIS development (SQLSaturday Chicago)
Biml for Beginners: Script and Automate SSIS development (24 Hours of PASS: S...
Biml for Beginners: Script and Automate SSIS development (SQLSaturday Oslo)
Biml for Beginners: Speed up your SSIS development (SQLSaturday Nashville)
Biml for Beginners: Speed up your SSIS development (SQL PASS Edmonton )
Biml for Beginners: Script and Automate SSIS development (SQLSaturday Finland)
Level Up Your Biml: Best Practices and Coding Techniques (SQLBits 2018)
BIML: BI to the next level
Level Up Your Biml: Best Practices and Coding Techniques (PASS Summit 2018)
Biml Tips and Tricks: Not Just for SSIS Packages! (SQLGrillen 2018)
Level Up Your Biml: Best Practices and Coding Techniques (SQLDay 2018)
Tools and Tips: From Accidental to Efficient Data Warehouse Developer (SQLBit...
BIML- What is it good for?
BI xPress - Pragmatic Works
A hands-on-guide-for-working-with-mapplets
Ad

More from Cathrine Wilhelmsen (20)

PDF
Fra utvikler til arkitekt: Skap din egen karrierevei ved å utvikle din person...
PDF
One Year in Fabric: Lessons Learned from Implementing Real-World Projects (PA...
PDF
Data Factory in Microsoft Fabric (MsBIP #82)
PDF
Getting Started: Data Factory in Microsoft Fabric (Microsoft Fabric Community...
PDF
Choosing Between Microsoft Fabric, Azure Synapse Analytics and Azure Data Fac...
PDF
Website Analytics in My Pocket using Microsoft Fabric (SQLBits 2024)
PDF
Data Integration using Data Factory in Microsoft Fabric (ESPC Microsoft Fabri...
PDF
Choosing between Fabric, Synapse and Databricks (Data Left Unattended 2023)
PDF
Data Integration with Data Factory (Microsoft Fabric Day Oslo 2023)
PDF
The Battle of the Data Transformation Tools (PASS Data Community Summit 2023)
PDF
Visually Transform Data in Azure Data Factory or Azure Synapse Analytics (PAS...
PDF
Building an End-to-End Solution in Microsoft Fabric: From Dataverse to Power ...
PDF
Website Analytics in my Pocket using Microsoft Fabric (AdaCon 2023)
PDF
Choosing Between Microsoft Fabric, Azure Synapse Analytics and Azure Data Fac...
PDF
Stressed, Depressed, or Burned Out? The Warning Signs You Shouldn't Ignore (D...
PDF
Stressed, Depressed, or Burned Out? The Warning Signs You Shouldn't Ignore (S...
PDF
"I can't keep up!" - Turning Discomfort into Personal Growth in a Fast-Paced ...
PDF
Lessons Learned: Implementing Azure Synapse Analytics in a Rapidly-Changing S...
PDF
6 Tips for Building Confidence as a Public Speaker (SQLBits 2022)
PDF
Lessons Learned: Understanding Pipeline Pricing in Azure Data Factory and Azu...
Fra utvikler til arkitekt: Skap din egen karrierevei ved å utvikle din person...
One Year in Fabric: Lessons Learned from Implementing Real-World Projects (PA...
Data Factory in Microsoft Fabric (MsBIP #82)
Getting Started: Data Factory in Microsoft Fabric (Microsoft Fabric Community...
Choosing Between Microsoft Fabric, Azure Synapse Analytics and Azure Data Fac...
Website Analytics in My Pocket using Microsoft Fabric (SQLBits 2024)
Data Integration using Data Factory in Microsoft Fabric (ESPC Microsoft Fabri...
Choosing between Fabric, Synapse and Databricks (Data Left Unattended 2023)
Data Integration with Data Factory (Microsoft Fabric Day Oslo 2023)
The Battle of the Data Transformation Tools (PASS Data Community Summit 2023)
Visually Transform Data in Azure Data Factory or Azure Synapse Analytics (PAS...
Building an End-to-End Solution in Microsoft Fabric: From Dataverse to Power ...
Website Analytics in my Pocket using Microsoft Fabric (AdaCon 2023)
Choosing Between Microsoft Fabric, Azure Synapse Analytics and Azure Data Fac...
Stressed, Depressed, or Burned Out? The Warning Signs You Shouldn't Ignore (D...
Stressed, Depressed, or Burned Out? The Warning Signs You Shouldn't Ignore (S...
"I can't keep up!" - Turning Discomfort into Personal Growth in a Fast-Paced ...
Lessons Learned: Implementing Azure Synapse Analytics in a Rapidly-Changing S...
6 Tips for Building Confidence as a Public Speaker (SQLBits 2022)
Lessons Learned: Understanding Pipeline Pricing in Azure Data Factory and Azu...

Recently uploaded (20)

PDF
Foundation of Data Science unit number two notes
PDF
Introduction to Business Data Analytics.
PPTX
Major-Components-ofNKJNNKNKNKNKronment.pptx
PDF
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
PPTX
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
PDF
Launch Your Data Science Career in Kochi – 2025
PDF
Lecture1 pattern recognition............
PPT
Chapter 2 METAL FORMINGhhhhhhhjjjjmmmmmmmmm
PPTX
ALIMENTARY AND BILIARY CONDITIONS 3-1.pptx
PDF
Mega Projects Data Mega Projects Data
PPTX
1_Introduction to advance data techniques.pptx
PPT
Chapter 3 METAL JOINING.pptnnnnnnnnnnnnn
PPTX
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
PPTX
Data_Analytics_and_PowerBI_Presentation.pptx
PDF
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
PDF
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
PPTX
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
PPT
Reliability_Chapter_ presentation 1221.5784
PDF
.pdf is not working space design for the following data for the following dat...
Foundation of Data Science unit number two notes
Introduction to Business Data Analytics.
Major-Components-ofNKJNNKNKNKNKronment.pptx
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
Launch Your Data Science Career in Kochi – 2025
Lecture1 pattern recognition............
Chapter 2 METAL FORMINGhhhhhhhjjjjmmmmmmmmm
ALIMENTARY AND BILIARY CONDITIONS 3-1.pptx
Mega Projects Data Mega Projects Data
1_Introduction to advance data techniques.pptx
Chapter 3 METAL JOINING.pptnnnnnnnnnnnnn
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
Data_Analytics_and_PowerBI_Presentation.pptx
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
Reliability_Chapter_ presentation 1221.5784
.pdf is not working space design for the following data for the following dat...

Biml for Beginners - Generating SSIS Packages with BimlScript (SQLSaturday Gothenburg)

  • 1. Biml for Beginners: Generating SSIS packages with BimlScript Cathrine Wilhelmsen September 5th 2015
  • 2. Session description SSIS is a powerful tool for extracting, transforming and loading data, but creating the actual SSIS packages can be both tedious and time- consuming. Even if you use templates and follow best practices you often have to repeat the same steps over and over again. There are no easy ways to handle metadata and schema changes, and if there are new requirements you might have to go through all the packages one more time. It's time to bring the Don't Repeat Yourself principle to SSIS development. In this session I will use the free BIDS Helper add-in to show you the basics of Biml and BimlScript, how to generate SSIS packages automatically from databases, how easy those packages can be changed, and how to move common code to separate files that can be included where needed. See why they say Biml allows you to complete in a day what once took more than a week!
  • 3. @cathrinew cathrinewilhelmsen.net Data Warehouse Architect Business Intelligence Developer Cathrine Wilhelmsen
  • 4. Who are you? (*) SSIS and ETL Developer? Easily bored? Tired of repetitive work? ( * Probably not a cat )
  • 5. Why are you here? Long development time? Many SSIS packages? Slow GUI editor? (Drag, drop, drag, drop, connect, drag, drop, connect, resize, align, drag, drop, resize, connect, align…)
  • 6. job done! new standards yay Have you ever experienced this?
  • 7. Ready for a change?
  • 8. Business Intelligence Markup Language Easy to read and write XML dialect Specifies business intelligence objects Databases, schemas, tables, columns SSIS packages SSAS cubes, facts, dimensions (Mist only)
  • 9. Highlights in Biml History founded by Scott Currie, is born Biml was extended with Biml compiler added to is launched founded is launched 2008: 2009: 2011: 2012: 2014: 2015:
  • 10. How can Biml help you? Timesaving: Many SSIS Packages from one Biml file Reusable: Write once and run on any platform (2005 – 2014) Flexible: Start simple, expand as you learn (Of course I can create 200 packages! What do you need me to do after lunch?)
  • 11. What do you need?
  • 12. How does it work? Generated packages are indistinguishable from manually created packages
  • 13. Biml syntax <Biml xmlns="http://schemas.varigence.com/biml.xsd"> <Packages> <Package Name="EmptyPackage1"></Package> <Package Name="EmptyPackage2"/> </Packages> </Biml>
  • 14. Biml syntax: Root Element <Biml xmlns="http://schemas.varigence.com/biml.xsd"> <Packages> <Package Name="EmptyPackage1"></Package> <Package Name="EmptyPackage2"/> </Packages> </Biml>
  • 15. Biml syntax: Collection of Elements <Biml xmlns="http://schemas.varigence.com/biml.xsd"> <Packages> <Package Name="EmptyPackage1"></Package> <Package Name="EmptyPackage2"/> </Packages> </Biml>
  • 16. Biml syntax: Elements <Biml xmlns="http://schemas.varigence.com/biml.xsd"> <Packages> <Package Name="EmptyPackage1"></Package> <Package Name="EmptyPackage2"/> </Packages> </Biml>
  • 17. Biml syntax: Attributes <Biml xmlns="http://schemas.varigence.com/biml.xsd"> <Packages> <Package Name="EmptyPackage1"></Package> <Package Name="EmptyPackage2"/> </Packages> </Biml>
  • 18. Biml syntax: Full vs. Shorthand Syntax <Biml xmlns="http://schemas.varigence.com/biml.xsd"> <Packages> <Package Name="EmptyPackage1"></Package> <Package Name="EmptyPackage2"/> </Packages> </Biml>
  • 20. Getting started with Biml 1. Download and install BIDS Helper (http://bidshelper.codeplex.com) 2. Right-click on SSIS project and click Add New Biml File
  • 21. Intellisense Intellisense while typing CTRL+Space to AutoComplete or show Intellisense
  • 22. Errors Red squiggly line: Error Blue squiggly line: Missing attribute or child element Error spelling Missing attribute: ConstraintMode
  • 23. Errors Hovering over errors will show descriptive text Missing attribute: ConstraintMode Error spelling
  • 24. Right-click to Check Biml for Errors
  • 25. Your first SSIS Package from Biml Right-click on Biml file and click Generate SSIS Packages Packages will appear under SSIS Packages
  • 26. From Biml to SSIS
  • 27. From Biml to SSIS
  • 28. .biml vs .dtsx: human-readable vs ALL THE CODE! (150% zoom) (20% zoom)
  • 29. I create SSIS packages faster than that
  • 31. The magic is in the Extend Biml with C# or VB.NET code blocks Import database structure and metadata Loop over tables and columns Add expressions to replace static values Allows you to control and manipulate Biml code
  • 32. BimlScript code blocks <#@ … #> Directives (Instructions to the BimlCompiler) <# … #> Control Blocks (Control logic) <#= … #> Expression Control Blocks (Replace block with string value) <#+ … #> Class Feature Control Blocks (Create helper methods)
  • 33. BimlScript syntax <Biml xmlns="http://schemas.varigence.com/biml.xsd"> <Packages> <# foreach (var table in RootNode.Tables) { #> <Package Name="Load<#=table.Name#>"></Package> <# } #> </Packages> </Biml>
  • 34. BimlScript syntax: Control Blocks <Biml xmlns="http://schemas.varigence.com/biml.xsd"> <Packages> <# foreach (var table in RootNode.Tables) { #> <Package Name="Load<#=table.Name#>"></Package> <# } #> </Packages> </Biml>
  • 35. BimlScript syntax: Expression Control Block <Biml xmlns="http://schemas.varigence.com/biml.xsd"> <Packages> <# foreach (var table in RootNode.Tables) { #> <Package Name="Load<#=table.Name#>"></Package> <# } #> </Packages> </Biml>
  • 36. How does it work?
  • 37. Yes, but how does it work? 37
  • 38. 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>
  • 40. Basic for loop <Packages> <# for (int count = 1; count <= 5; count++) { #> <Package Name="Load_Person_Person_<#=count#>"> </Package> <# } #> </Packages>
  • 41. foreach (table in a database) loop <#@ import namespace="Varigence.Hadron.CoreLowerer.SchemaManagement" #> <# var conAW2014 = SchemaManager.CreateConnectionNode("AW2014", "Data Source..."); #> <# var AW2014DB = conAW2014.ImportDB("","", ImportOptions.ExcludeViews); #> <Packages> <# foreach (var table in AW2014DB.TableNodes) { #> <Package Name="Load_<#=table.Schema#>_<#=table.Name#>"> </Package> <# } #> </Packages>
  • 42. Don't Repeat Yourself Move common code to separate files Centralize and reuse in many projects Update code once for all projects 1. Split and combine Biml files 2. Include files 3. CallBimlScript with parameters
  • 43. Split and combine Biml files Solve logical dependencies and simulate manual workflows by using tiers Tiers instruct the BimlCompiler to compile files from lowest to highest tier <#@ template tier="1" #> Higher tiers can use and might depend on objects from lower tiers Tier 1 - Create database connections Example: Tier 2 - Create loading packages Tier 3 - Create master package to execute loading packages
  • 44. Split and combine Biml files 1. Create Biml files with specified tiers 2. Select all the tiered Biml files 3. Right-click and click Generate SSIS Packages 1 2 3
  • 45. Behind the scenes: Split and combine Biml files RootNode <#@ template tier="0" #> <Connections> <Databases> <Schemas> <#@ template tier="1" #> <Tables> <Columns> <#@ template tier="2" #> <Packages>
  • 46. <Connections> <Databases> <Schemas>RootNode <#@ template tier="0" #> <Connections> <Databases> <Schemas> <#@ template tier="1" #> <Tables> <Columns> <#@ template tier="2" #> <Packages> compile Behind the scenes: Split and combine Biml files
  • 47. <Connections> <Databases> <Schemas>RootNode <#@ template tier="0" #> <Connections> <Databases> <Schemas> <#@ template tier="1" #> <Tables> <Columns> <#@ template tier="2" #> <Packages> use Behind the scenes: Split and combine Biml files
  • 48. <Connections> <Databases> <Schemas> <Tables> <Columns> RootNode <#@ template tier="0" #> <Connections> <Databases> <Schemas> <#@ template tier="1" #> <Tables> <Columns> <#@ template tier="2" #> <Packages> compile Behind the scenes: Split and combine Biml files
  • 49. <Connections> <Databases> <Schemas> <Tables> <Columns> RootNode <#@ template tier="0" #> <Connections> <Databases> <Schemas> <#@ template tier="1" #> <Tables> <Columns> <#@ template tier="2" #> <Packages> use Behind the scenes: Split and combine Biml files
  • 50. <Connections> <Databases> <Schemas> <Tables> <Columns> <Packages> RootNode <#@ template tier="0" #> <Connections> <Databases> <Schemas> <#@ template tier="1" #> <Tables> <Columns> <#@ template tier="2" #> <Packages> compile Behind the scenes: Split and combine Biml files
  • 51. <Connections> <Databases> <Schemas> <Tables> <Columns> <Packages> RootNode <#@ template tier="0" #> <Connections> <Databases> <Schemas> <#@ template tier="1" #> <Tables> <Columns> <#@ template tier="2" #> <Packages> generate Behind the scenes: Split and combine Biml files
  • 52. RootNode <#@ template tier="0" #> <Connections> <Databases> <Schemas> <#@ template tier="1" #> <Tables> <Columns> <#@ template tier="2" #> <Packages> Behind the scenes: Split and combine Biml files
  • 53. Don't Repeat Yourself: Include files Include common code in multiple files and projects Can include many file types: .biml .txt .sql .cs Use the include directive <#@ include file="CommonCode.biml" #> The include directive will be replaced by the content of the included file Include pulls code from the included file into the main file
  • 54. Don't Repeat Yourself: Include files
  • 55. Don't Repeat Yourself: CallBimlScript with parameters Works like a parameterized include File to be called (callee) specifies the input parameters it accepts <#@ property name="Table" type="AstTableNode" #> File that calls (caller) passes input parameters <#=CallBimlScript("CommonCode.biml", Table)#> CallBimlScript pushes parameters from the caller to the callee, and the callee returns code
  • 56. Don't Repeat Yourself: CallBimlScript with parameters
  • 57. Don't Repeat Yourself: CallBimlScript with parameters
  • 58. Demo
  • 59. View compiled Biml Credits: Marco Schreuder (@in2bi) http://blog.in2bi.eu/biml/viewing-or-saving-the- compiled-biml-file-s/ Helper file with high tier (tier="100") Saves output of RootNode.GetBiml() to file
  • 60. What do you do next? 1. Download BIDS Helper 2. Identify your SSIS patterns 3. Rewrite one SSIS package to Biml to learn the basics 4. Expand with BimlScript 5. Get involved in the Biml community
  • 61. Biml on Monday... …BimlBreak the rest of the week 
  • 62. More Biml! Don't miss Rasmus Reinholdt's session Building a meta-driven near realtime ETL solution with BIML and SSIS at 14:55! …and come chat with us in the breaks 