Design Pattern // Logging an ETL process with T-SQL

How can you judge whether an ETL process has been successful? The mere fact that a process was not terminated with an exception does not necessarily mean that the process did what was expected of it. Readable and evaluable logging of an ETL process can help here. It enables a reliable assessment of the success of an ETL process.

This article presents a design pattern for logging an ETL process based on stored procedures that insert and update log records in log tables. The aim is to create a readable and evaluable protocol that provides answers to essential questions about the execution of an ETL process:

  • How long does the ETL process take in total?
  • How long does a stored procedure, SSIS package, or other component take to execute?
  • How long does it take to execute a specific SQL statement?
  • How many records were processed by an SQL statement?

Of course, we also want to know whether the process as a whole, a procedure or even a specific SQL statement was executed successfully.

The procedure is actually straightforward: At the beginning of each action, a log data record is written and after the action is completed, it is updated with either the status success or failure and, if necessary, other helpful information. That’s it! But it can still be a little more…

Read more

SSIS vs. SQL – Readability/Maintenance -or- How much of SQL you want to have in your SSIS package?

How this articel has developed… SQL Server Integration Services (SSIS) is a very powerful graphical tool set belonging to the Microsoft BI Stack along with SQL Server, SQL Server Analysis Services (SSAS), SQL Server Reporting Services (SSRS), etc. It supports a broad variety of data migration, integration and transformation tasks. With that, you will find … Read more

SSIS vs. SQL – Source Code Management

Dieser Artikel in Deutsch… Overview SQL Server Integration Services (SSIS) is a very powerful graphical tool set belonging to the Microsoft BI Stack along with SQL Server, SQL Server Analysis Services (SSAS), SQL Server Reporting Services (SSRS), etc. It supports a broad variety of data migration, integration and transformation tasks. With that, you will find … Read more

SSIS vs. SQL – Impersonation

Overview SQL Server Integration Services (SSIS) is a very powerful graphical tool set belonging to the Microsoft BI Stack along with SQL Server, SQL Server Analysis Services (SSAS), SQL Server Reporting Services (SSRS), etc. It supports a broad variety of data migration, integration and transformation tasks. With that, you will find a bunch of good … Read more

SSIS vs. SQL

Overview SQL Server Integration Services (SSIS) is a very powerful graphical tool set belonging to the Microsoft BI Stack along with SQL Server. It supports a broad variety of data migration, integration and transformation tasks. With that, you will find a bunch of good reasons why to utilize this tool set. With Transact SQL (T-SQL) … Read more

Inline Comments in complex SQL statements

Overview Documentation should be an inherent part of any database development project. Virtually everybody would agree with this. However, documentation is usually the first goal to be a victim of project pressure. “If you want to know what the code does, have a look at the code.” This is a very common view on missing … Read more

Formatting SQL Statements (Part 2)

Dieser Artikel in Deutsch… Introduction Developing SQL code follows a completely opposed paradigm compared to developing software code. While one single SQL statement may consist of hundreds of lines, software commands tend to be rather short and compact. You use many commands for achieving a goal in software development. In SQL server it is highly … Read more

Formatting SQL Statements (Part 1)

Dieser Artikel in Deutsch… Overview Capital letters are often used to emphasize single words. This applies, for example, to German as a language. Latin, Greek, … Although there are languages that do distinct between upper and lower case (with respect to nouns), it has nevertheless prevailed in most languages. Even in English you can sometimes … Read more

Structuring and Formatting SQL Statements

Dieser Artikel in Deutsch… Overview Recently, I had to revise a Stored Procedure with nearly 2.000 lines of code. The procedure was edited by three developers, one after another. It contained sub statements for about 30 tables with varying degrees of complexity. But essentially all Sub-Statements were designed to fulfill a similar task. While all … Read more

Functional Design (Aesthetics) of SQL

Dieser Artikel in Deutsch… Overview A good programming style is the basis for readable and comprehensive source code and thus contributes substantially to the maintainability of software in the broadest sense. Well formatted code, definition and adherence to naming conventions are just a few criteria. The design (aesthetics) is subject to personal preferences of developers … Read more