Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Biml for Beginners: Speed up your SSIS development (SQLBits XV)

602 views

Published on

Biml for Beginners: Speed up your SSIS development (Presented at SQLBits XV in London on May 7th 2016)

Published in: Data & Analytics
  • Be the first to comment

Biml for Beginners: Speed up your SSIS development (SQLBits XV)

  1. 1. Biml for Beginners: Speed up your SSIS development Cathrine Wilhelmsen · SQLBits XV · May 7th 2016
  2. 2. Session Description SSIS is a powerful tool for extracting, transforming and loading data, but creating and maintaining a large number of 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 and over again. Handling metadata and schema changes is a manual process, and there are no easy ways to implement new requirements in multiple packages at the same time. It is time to bring the Don't Repeat Yourself (DRY) software engineering principle to SSIS projects. First learn how to use Biml and BimlScript to generate SSIS packages from database metadata and implement changes in all packages with just a few clicks. Then take the DRY principle one step further and learn how to update all packages in multiple projects by separating and reusing common code. Speed up your SSIS development by using Biml and BimlScript, and see how you can complete in a day what once took more than a week!
  3. 3. Tools & Projects Code Management The Basics a
  4. 4. Cathrine Wilhelmsen @cathrinew cathrinewilhelmsen.net Data Warehouse Architect Business Intelligence Developer
  5. 5. SSIS developer? Easily bored? Tired of repetitive work? You…
  6. 6. Long development time? Many SSIS packages? Frequent requirement changes? Work…
  7. 7. Ever experienced this? takeoff! new standards crash landing!
  8. 8. Ready for a change?
  9. 9. Business Intelligence Markup Language Easy to read and write XML language Describes business intelligence objects: • Databases, Schemas, Tables, Views, Columns • SSIS Packages • SSAS Cubes What is Biml?
  10. 10. From Traditional SSIS to Agile SSIS Traditional SSIS: Plumbing Agile SSIS: Business Logic
  11. 11. Will Biml solve all your problems? Probably not... Biml is a tool for generating SSIS packages Biml is not a pre-defined ETL framework Biml is not a tool for automated deployment ...but it will solve many problems!
  12. 12. How can Biml help you? Timesaving: Many SSIS Packages from one Biml file Reusable: Write once and run on any platform Flexible: Start simple, expand as you learn
  13. 13. What do you need?
  14. 14. …or you can use the new Biml tools
  15. 15. How does it work? …generated packages look exactly like manually created packages
  16. 16. Biml syntax <Biml xmlns="http://schemas.varigence.com/biml.xsd"> <Packages> <Package Name="EmptyPackage1"></Package> <Package Name="EmptyPackage2"/> </Packages> </Biml>
  17. 17. <Biml xmlns="http://schemas.varigence.com/biml.xsd"> <Packages> <Package Name="EmptyPackage1"></Package> <Package Name="EmptyPackage2"/> </Packages> </Biml> Biml syntax: Root Element
  18. 18. <Biml xmlns="http://schemas.varigence.com/biml.xsd"> <Packages> <Package Name="EmptyPackage1"></Package> <Package Name="EmptyPackage2"/> </Packages> </Biml> Biml syntax: Collections of Root Objects
  19. 19. <Biml xmlns="http://schemas.varigence.com/biml.xsd"> <Packages> <Package Name="EmptyPackage1"></Package> <Package Name="EmptyPackage2"/> </Packages> </Biml> Biml syntax: Elements
  20. 20. <Biml xmlns="http://schemas.varigence.com/biml.xsd"> <Packages> <Package Name="EmptyPackage1"></Package> <Package Name="EmptyPackage2"/> </Packages> </Biml> Biml syntax: Attributes
  21. 21. <Biml xmlns="http://schemas.varigence.com/biml.xsd"> <Packages> <Package Name="EmptyPackage1"></Package> <Package Name="EmptyPackage2"/> </Packages> </Biml> Biml syntax: Full vs. Shorthand Syntax
  22. 22. <Biml xmlns="http://schemas.varigence.com/biml.xsd"> <Packages> <Package Name="EmptyPackage1">...</Package> <Package Name="EmptyPackage2"/> </Packages> </Biml> Biml syntax: Full vs. Shorthand Syntax
  23. 23. Let's generate some packages!
  24. 24. Ok, so we can go from Biml to SSIS…
  25. 25. …can we go from SSIS to Biml?
  26. 26. Yes! :)
  27. 27. Let's reverse-engineer some packages!
  28. 28. The magic is in the
  29. 29. What is BimlScript? Extend Biml with C# or VB code blocks Import database structure and metadata Loop over tables and columns Expressions replace static values Allows you to control and manipulate Biml code
  30. 30. BimlScript Code Nuggets <#@ … #> Directives (Compiler instructions) <# … #> Control Nuggets (Control logic) <#= … #> Text Nuggets (Returns string) <#+ … #> Class Nuggets (Create helper classes)
  31. 31. 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>
  32. 32. BimlScript Syntax: Control Nuggets <Biml xmlns="http://schemas.varigence.com/biml.xsd"> <Packages> <# foreach (var table in RootNode.Tables) { #> <Package Name="Load_<#=table.Name#>"></Package> <# } #> </Packages> </Biml>
  33. 33. BimlScript Syntax: Text Nuggets <Biml xmlns="http://schemas.varigence.com/biml.xsd"> <Packages> <# foreach (var table in RootNode.Tables) { #> <Package Name="Load_<#=table.Name#>"></Package> <# } #> </Packages> </Biml>
  34. 34. How does it work?
  35. 35. Yes, but how does it work?
  36. 36. Yes, but how does it actuallywork? <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="Load_Customer"/> <Package Name="Load_Product"/> <Package Name="Load_Sales"/> </Packages> </Biml>
  37. 37. Biml vs. BimlScript Automate, control and manipulate Biml with C# Flat XML "Just text"
  38. 38. Let's generate a lot of packages!
  39. 39. Don't Repeat Yourself
  40. 40. Move common code to separate files Centralize and reuse in many projects Update code once for all projects 1. Include files 2. CallBimlScript with parameters 3. Tiered Biml files Don't Repeat Yourself
  41. 41. BimlExpress vs. BimlOnline "Black Box" Only SSIS packages visible Visual Editors All in-memory objects visible
  42. 42. 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 directive will be replaced by the included file Include pulls code from the included file into the main file
  43. 43. Include Files
  44. 44. Include Files
  45. 45. Include Files
  46. 46. CallBimlScript with Parameters Works like a parameterized include File to be called (callee) specifies 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
  47. 47. CallBimlScript with Parameters
  48. 48. CallBimlScript with Parameters
  49. 49. CallBimlScript with Parameters
  50. 50. CallBimlScript with Parameters
  51. 51. CallBimlScript with Parameters
  52. 52. Tiered Biml Files Use the template directive: <#@ template tier="1" #> Create objects in-memory from lowest to highest tier to: • Solve logical dependencies • Simulate manual workflows In-memory objects are added to the RootNode Get objects from RootNode in higher tiers
  53. 53. So how does this actually work?
  54. 54. Get things done Start small Start simple Start with ugly code Keep going Expand Improve Deliver often
  55. 55. Biml on Monday... …BimlBreak the rest of the week :)
  56. 56. @cathrinew cathrinewilhelmsen.net linkedin.com/in/cathrinewilhelmsen contact@cathrinewilhelmsen.net slideshare.net/cathrinewilhelmsen Biml resources and references: cathrinewilhelmsen.net/biml

×