Biml Tutorial Biml Language Basics


By:
Overview

In this chapter we will take a look at the foundations of the Biml language.

Itís all XML

As mentioned before, Biml is basically XML. This means it follows the hierarchical structure of XML. Letís illustrate with an example. This piece of Biml describes a simple package with one connection and one Execute SQL Task:

simple Biml file

The script starts with the Biml root node and then child nodes are added. Simplified, the hierarchical structure of Biml can be represented with this schema:

hierarchical structure of Biml

The Biml node can have connections, fileformats (used with flat files) and packages. Packages have tasks and containers and containers can contain tasks.

A data flow is a special task, which has its own set of child nodes:

hierarchy of data flow

This schema just represents the basics of an SSIS package. With Biml you can specify every construct that you can also create manually in Visual Studio: event handlers, log providers, connection managers, package parameters, variables, expressions, script tasks and so on. The only notable exception are project parameters, which can be specified in Biml, but will not actually be generated.

You can find more info about the Biml language elements in the official documentation.

Since itís XML, Biml has to adhere to some rules. Each element has an opening and a closing tag, or it is an empty tag. An element can have zero or more attributes.

xml structure with elements and attributes

Keep in mind some characters are reserved characters in XML. They need to be replaced with escape codes:

Character Escape code
double quote "  "
single quote ' '
< &lt;
> &gt;
& &amp;

You can also specify comments in Biml, just as in XML:

comment in Biml

Why XML?

Biml uses XML because SSIS packages are also XML behind the scenes. You can verify this by right-clicking a package and selecting View Code.

view code

However, the XML of Biml is much more simplified than the XML schema used for SSIS packages. Itís certainly more readable; you can manually write it if you desire. This makes Biml an ideal starting point for automating the creation of your SSIS packages. Itís also much easier to compare Biml files (through source control for example) and to reuse code. In the next chapter, we will write a bit of Biml code to generate our first package.

Additional Information

Last Update: 2/18/2018




Comments For This Article





download














get free sql tips
agree to terms