Skip to main content

Export To File

An outline for using BimlFlex to export data out of a database into files. The export process supports the following template patterns:

  • source to file
  • source to zip file

These templates provide the necessary ETL transformations and destination components needed to successfully extract to a file.

File Options​

There are several file format options available for file exports. Extension Points can override the behavior for custom requirements.

The Object Editor of the BimlFlex App contains the following settings for file formats.

Flat File Types​

Attribute NameDescription
DelimitedFields in row are delimited by character
FixedWidthEach field/row has a fixed width
RaggedRightThe last field in row can have variable width, delimited by new row character

Data Rows to Skip​

This is the count of rows from the start of the file to the header row or the start of data.

TextQualifier​

What character delimits the text in a given column. E.g. "text", 'text', etc.

Delimiters​

Column and row delimiters and Last Column Delimiter

Attribute NameDescription
CRLFCarriage Return, Line Feed - ASCII 13, 10
CRCarriage Return - ASCII 13
LFLine Feed - ASCII 10
Semicolon;
Comma,
TabHT - ASCII 09
VerticalBar`
UnitSeparatorUS - ASCII 31
CustomAny valid custom delimiter

Code Page​

The code page to use for the generated file. This is a standard SSIS attribute. Reference the following Microsoft documentation for more information:

MSDN - Code Page Identifiers

Source to File​

ETL Pattern Overview​

The File Extract template extracts data from the data warehouse or other database source into a flat file destination.

The components and ETL pattern are similar to a regular source to target pattern. There are additional metadata requirements for defining the destination file.

Export to File ETL Pattern

Adding Source to File Metadata​

Connections​

The first step is setting up the connection attributes that are relevant to setting a flat file connection. In the source to file scenario, this would be the intended destination connection. For connections ensure to choose "Staging" as the Integration stage. Some example connection attributes that mimic this are shown below

Attribute NameExample Project Attributes
NameTransactionsFile
ConnectionStringC:\ExportFiles
CatalogTransactions
ConnectionTypeFILE
SystemTypeFile Delimited, File Ragged Right, Excel
IntegrationStageStaging
RecordSourceTF
FilePathC:\ImportFiles\
FilePatternTransactions*.*
NoOfThreads0

Batches​

The second metadata entity that a user will need to fill in is the Batch entity. The Batch for a project is the parent package that executes the child packages that in turn perform the data load. In the Batch Editor of the BimlFlex App, add a new batch with an appropriate name, set its Threads, and choose whether to check Use Orchestration.

Projects​

Add a project in the Project Editor of the BimlFlex App. Generally, it will follow the usual source to target metadata with a couple of differences. In this case, ensure that File Extract (SSIS) is selected as the Integration Template. This is important as it indicates to the BimlFlex framework what the type of project is and its purpose.

Objects and Columns​

Now to add both the source file definition and the target table definition as Objects in the BimlFlex App. For the target transactions file that is intended to be loaded to, fill in the File Settings of the Object Editor: Flat File Type, Text Qualifier, Row Delimiter, Column Delimiter, Last Column Delimiter, Data Rows To Skip, Column Names In First Row, Code Page and Unicode.

Supplying BimlFlex with this metadata will ensure the correct file formats are being loaded further on in the development and build stages.

Each destination File defined as an Object requires all destination columns to be defined.

Each source column needs to be mapped to its respective destination column. This is done by setting Target Table and Target Column on each column of the source table in the Column Editor.

Once the metadata has been set in the BimlFlex App, refresh the solution metadata in BimlStudio, build the solution and test.

Source to Zip File​

BimlFlex provides a separate template for destinations that require the generated file to be zipped. In addition to the previous file export template, this adds a file compression step at the end of the control flow.

ETL Pattern Overview​

Export workflow

Adding Source to Zip File Metadata​

Connections​

Assuming there already exist various layers in the data warehouse to extract from, the first thing to do is to create a new flat file connection in the BimlFlex App. Some example connection attributes are shown below:

Attribute NameExample Project Attributes
NameTransactionsFile
ConnectionStringC:\ExportFiles\Compressed
CatalogTransactions
ConnectionTypeFILE
SystemTypeFile Delimited, File Ragged Right, Excel
IntegrationStageStaging
RecordSourceTF
FilePathC:\ExportFiles\Compressed\
FilePatternTransactions*.*
NoOfThreads0

Batches​

The second metadata entity that needs to be defined is the Batch entity. The Batch will be the parent package that executes any child packages that actually export data. So, in this case, add a new batch with the appropriate name in the BimlFlex App. Set the number of Threads to load with and choose whether to check Use Orchestration.

Projects​

The next step is to add a project. It will generally follow the usual source to target metadata. In this case, ensure that Zip File Extract (SSIS) is chosen as the Integration Template. This will indicate to BimlFlex that there are extra requirements around loading to a file and compressing it etc.

Objects and Columns​

Both the source definition and target definition are required as Objects. For the target object, fill in the File Settings of the Object Editor in the same way as for the source to file pattern above.

To finish implementing this pattern, the column definitions for the destination are required. In this case, the Transactions table. They need to be pointed to the destination file.

This is done by setting Target Table and Target Column on the columns that define the source table, in this case, the Transactions source table.

Finally, refresh the BimlFlex metadata in BimlStudio, build and test.