SlideShare a Scribd company logo
1 of 45
Continuous Integration
and the
Data Warehouse
Dr. John Tunnicliffe
Independent BI Architect &
Hands-On Developer
Mobile: +44 7771 818770
john@bovi.co.uk
Blog: http://sqlblogcasts.com/blogs/drjohn/
Agenda
 What is CI?
 SQL Server Data Tools (SSDT)
 PowerShell and psake build tools
 TeamCity Build Server
 Nbi Test framework
 SSDT and T4 Templates
Different approaches to
SQL database development
Migration Scripts
 Manually prepare
upgrade scripts
 Must be run in correct order
 Scripts are combination
of DDL and data fixes
 Manual deployment
Declarative Model
 Define what we want
 Tool creates migration
scripts
 Still need data fixes
 Automated deployments
Hands up
 Who has entire BI solution under source code control?
 Including SQL databases, all SSIS packages, all SSAS cubes
 SSDT and the declarative model approach?
 Who already uses CI in a data warehouse context?
 Does CI also deploy & test your code?
What is Continuous Integration?
Continuous Integration is a development practice that
requires developers to integrate code into a shared
repository several times a day.
Each check-in is verified by an automated build,
deploy and test cycle which allows errors to be
detected and thereby corrected quickly.
Benefits of Continuous Integration
 Eradication of manual integrations and deployments
 Catches issues fast
 Reduces production & staging errors
 Automated testing provides quality assurance
 CI allows developers to proceed with confidence
 CI provides reporting on quality of the code base
 Facilitates Continuous Delivery
Applying CI to the Data Warehouse
Why is it so difficult?
 BI developers are not familiar with CI
 Never seen it in action in a DWH context
 Not familiar with the tools and techniques
 Cannot comprehend how it can be applied
 Data is a BIG barrier
 PROD data is different to DEV
 Problems often only manifest themselves in PROD data
 Time taken to load data
Data Warehouse
 Project started 2010
 SQL 2008 R2 – tools & techniques have remained static
 Various “initiatives” have resulted in a confused data architecture
 Three competing data streams and lots of data marts
 Overly complicated and complex!
 100,000 files in the code-base!
 14 database, 200 SSIS packages, 4 multidimensional cubes
 7 developers, 4 testers, 3 BAs, 1 S2T, 1 DBA, 1 PM
 Each database had 2 VSDT projects – split “storage” and “code”
 Configuration scattered across code base
 Manual build and very manual deploy – 1 guy, 4 days per month!
 Each production release was getting longer, complex and error prone!
Data Warehouse
 Imported all databases into SQL Server Data Tools
 New SCC repository with simplified structure: only 8,900 files
 PowerShell script written to do local build & deployment
 Development tools
 Visual Studio 2013 for SQL Server Data Tools (SSDT)
 Visual Studio 2008 for SSIS and SSAS (servers still SQL 2008R2)
 TeamCity build server
 Creates single Nuget package containing all 14 databases, 200+
SSIS package and SSAS cubes plus deployment scripts
 Automatically deploys and tests everything
 Automatic deployment to test, UAT and other environments!
Key Considerations for CI
 Deployable artifacts
 What is generated from the code that I can deploy?
 Deployment
 How do I deploy the artifact?
 Configuration
 How can I set up the environment so that everything works?
Tools and techniques for CI
Source Code Control (SCC)
 ALL code MUST be under Source Code Control
 SQL Server, SSIS, BIML, SSAS, SSRS, Test Suites etc. etc.
 Recommend Using Three Branches
1. Development branch
2. Release branch
3. Prod branch
 SCC Locking strategy:
 Use optimistic locking for SQL, C#
 Use pessimistic locking for SSIS, SSAS and SSRS
SQL Server Data Tools
 Declarative model design environment for SQL Server
 Requires Visual Studio 2012+
 Supports SQL Server 2005+
 Very easy to import an existing database
 Must replace hard-coded database names with variables
 Add references to other databases and setup SQLCmd variables
 Don’t upgrade VSDT projects
 Instead start a new SSDT project and import a deployed
database instance
 Then transfer over pre- and post-deploy scripts
SQL Server Data Tools
SQL Server Data Tools
Adding a Database Reference
SQL Server Data Tools
Publishing your database
SQL Server Data Tools
DAC Publish Profile
SQL Server Data Tools
 Build generates a DACPAC => “deployable artifact”
 Contains entire database model
 Conforms to Open Packaging Convention = ZIP file!
 Use MsBuild to create DACPAC from solutions
 Use SQLPackage.exe to deploy DACPAC
The many actions of
SQLPackage.exe
 Publish
 Deploys a DACPAC
 Script
 Generates a T-SQL
deployment script from
a DACPAC
 Extract
 Creates a DACPAC
from a database
 Export
 Creates a BACPAC
 Import
 Imports a BACPAC
 DeployReport
 List of changes new
deploy will make
 DriftReport
 List of changes since
last deploy
PowerShell
 PowerShell is the “glue” for your CI project
 Part of Windows Management Framework
 4.0 built into Windows Server 2012 R2 and Windows 8.1
 Download and install WMF 4.0 for prior OS versions
 Advanced scripting
 Proper error handling Try-Catch
 Easy to read/write XML
 Ideal for dynamically generation of config files
 CmdLets
 Invoke-SQLCmd
 Invoke-ASCmd & SQLAS
psake
 Task-orientated build tool written in PowerShell
 Uses a dependency pattern similar to MSBuild or Make
 Download from https://github.com/psake/psake
 Build script consist of Tasks
 Each task can depend on other tasks
Tools and techniques for CI
psake
PowerShell
Where to Start
 Create a DeployConfig.xml file
 Describes your server environment
 Maps databases to servers, solutions to databases
 Develop PowerShell functions to read config file
 Dynamically build SQLCmd variables to pass into:
 DAC Publish profiles
 Invoke-SQLCmd
 Post-Load Data Fix Scripts
 User permission scripts
 SSIS Configurations / SQL Agent Jobs
 Dynamically create Nuget spec XML
 Package your build
Architecture
Projects
Workflow
1. Build Release Pack – Nuget package containing
 SQL databases, SSIS packages, SSAS cubes, etc.
2. Deploy Release Pack to Build Server
 Run post-deployment tests
 Unit tests on stored procs, functions, triggers
 Check database model, cube model, defaults
3. Restore Cut-Down dataset and Load
 Execute SSIS Packages / Load Cube
 Run Post-Load Tests
 Reconcile SSAS cube with SQL database
 Regression tests
 Fixed data set data checks
Build Configuration
Build Step
Version Control Settings
Notifier
 Tray icon
 Notifies developers
of broken builds
 Pops up dialog
 Links to TeamCity
web site
Build Log
Tools and techniques for CI
SSIS Artifacts
 File Mode Deployment (pre-2012)
 Build does nothing useful!
 SSIS package => “deployable artifact”
 Deployment simply copies packages into target location
 File Mode Configuration
 Update Package Configurations using PowerShell to:
 Update XML config
 Set SQLCmd variables and run a SQLCmd script which updates the
SSIS configuration table
Tools and techniques for CI
SSIS Artifacts
 Project Mode Deployment (SQL Server 2012+)
 Build generates an ISPAC => “deployable artifact”
 Use IsDeploymentWizard.exe to deploy the packages
 Project Mode Configuration
 Use SSISDB catalog stored procedures to:
 Create Projects & Folders
 Create Environments & Variables
 etc.
 Run as SQLCmd script from PowerShell
SSAS Artifacts
 Build
 Cannot be done with MsBuild!
 Must invoke Visual Studio (devenv.exe) to perform build
 Windows EXE => so pipe to Out-Null to force PowerShell to wait
 Generates a .AsDatabase file => “deployable artifact”
 Deploy
 Microsoft.AnalysisServices.Deployment.exe /s
 PowerShell to generate XML config files defining target server etc.
 Windows EXE => so pipe to Out-Null to force PowerShell to wait
 SSAS Partition Manager
 Deploys using AMO and also dynamically creates partitions
 SsasPartitionManager.codeplex.com
NBi Test Suite
 Open source framework to test your BI solutions
 Tests run using NUnit GUI or command-line runner
 Tests written in XML
 Can be dynamically manipulated using PowerShell
 Automatic generation of tests via:
 Tools provided with NBi suite – GenBI and GenBIL
 SELECT … FOR XML
 PowerShell etc.
 Run SQL, MDX and DAX queries
 Extract queries from SSRS reports
 Run SSIS packages and check “side effects”
 Check model structure
NBi Test Suite
 Extensive support for testing the model structure
NBi Test Suite
 Compare results of a query
 Static data set
 CSV
 Results of another query
 Check datatypes, nulls, empty strings, format etc.
 Apply tolerance and rounding
 Validate SQL query syntax
 Performance tests
 Clear the cache in test setup
 Check cube member count, ordering, existence etc.
Failing Tests
Failed Test
Unit Testing with SSDT
 Add a Unit Test C# project to your SSDT solution
Code Analysis with SSDT
 T-SQL Design Issues
 Checks for code that might not behave the way you expect
 Deprecated syntax
 Issues that could cause problems in the design
 T-SQL Naming Issues
 Naming issues arise when a database object violates generally
accepted conventions
 T-SQL Performance Issues
 Code that might noticeably reduce speed of database operations
 Extensible model
 Write your own Code Analysis
Top tips to using SSDT & CI
 No User Permissions
 Database roles only
 Assign Windows Groups to Roles in a post-deploy script
 Don’t deploy SQL Agent Jobs to CI server
 Use PowerShell to call the commands instead
 Hold SSIS configuration scripts outside SSDT
 Hold pre- and post-deploy data fix scripts external to
SSDT in a “release” folder
SSDT + T4 Templates
 T4 = Text Template Transformation Toolkit
 Built into Visual Studio 2005+
 Create code from code
 Example: History tables and triggers
 Old data should be written to a history table every time an update
done to the main table
 Problem: 200 main tables = 200 history tables + 200 triggers
SSDT + T4 Templates
 Three ways you could implement T4 Templates
1. Use ADO.NET to query catalog views on a materialized
(deployed) copy of the database
2. Use the Data-tier Application Framework (DACFx) to query the
content of the DACPAC generated by SSDT on your last build
3. Use the Data-tier Application Framework (DACFx) to query the
in-memory content of your SSDT project
 Very few examples
 Download my toolkit from t4dacfx2tsql.codeplex.com
 Read my blog on http://sqlblogcasts.com/blogs/drjohn/
Download my toolkit from
t4dacfx2tsql.codeplex.com
Continuous Integration
and the
Data Warehouse
Dr. John Tunnicliffe
Independent BI Architect &
Hands-On Developer
Mobile: +44 7771 818770
john@bovi.co.uk
Blog: http://sqlblogcasts.com/blogs/drjohn/

More Related Content

What's hot

SQL Server 2019 ctp2.2
SQL Server 2019 ctp2.2SQL Server 2019 ctp2.2
SQL Server 2019 ctp2.2Gianluca Hotz
 
SQL Server 2016: Just a Few of Our DBA's Favorite Things
SQL Server 2016: Just a Few of Our DBA's Favorite ThingsSQL Server 2016: Just a Few of Our DBA's Favorite Things
SQL Server 2016: Just a Few of Our DBA's Favorite ThingsHostway|HOSTING
 
Mysql Enterprise Edition Feature and Tools
Mysql  Enterprise Edition Feature and Tools Mysql  Enterprise Edition Feature and Tools
Mysql Enterprise Edition Feature and Tools jones4u
 
Adi Sapir ISUG 123 11/10/2012
Adi Sapir ISUG 123 11/10/2012Adi Sapir ISUG 123 11/10/2012
Adi Sapir ISUG 123 11/10/2012sqlserver.co.il
 
SQL Explore 2012 - Meir Dudai: DAC
SQL Explore 2012 - Meir Dudai: DACSQL Explore 2012 - Meir Dudai: DAC
SQL Explore 2012 - Meir Dudai: DACsqlserver.co.il
 
ZK MVVM, Spring & JPA On Two PaaS Clouds
ZK MVVM, Spring & JPA On Two PaaS CloudsZK MVVM, Spring & JPA On Two PaaS Clouds
ZK MVVM, Spring & JPA On Two PaaS CloudsSimon Massey
 
SQL server 2016 New Features
SQL server 2016 New FeaturesSQL server 2016 New Features
SQL server 2016 New Featuresaminmesbahi
 
Sql server 2012 roadshow masd overview 003
Sql server 2012 roadshow masd overview 003Sql server 2012 roadshow masd overview 003
Sql server 2012 roadshow masd overview 003Mark Kromer
 
Sql server-integration-services-ssis-step-by-step-sample-chapters
Sql server-integration-services-ssis-step-by-step-sample-chaptersSql server-integration-services-ssis-step-by-step-sample-chapters
Sql server-integration-services-ssis-step-by-step-sample-chaptersNadinKa Karimou
 
Windows azure sql_database_security_isug012013
Windows azure sql_database_security_isug012013Windows azure sql_database_security_isug012013
Windows azure sql_database_security_isug012013sqlserver.co.il
 
Cause 2013: A Flexible Approach to Creating an Enterprise Directory
Cause 2013: A Flexible Approach to Creating an Enterprise DirectoryCause 2013: A Flexible Approach to Creating an Enterprise Directory
Cause 2013: A Flexible Approach to Creating an Enterprise Directoryrwgorrel
 
Tech ED 2014 Running Oracle Databases and Application Servers on Azurev1
Tech ED 2014   Running Oracle Databases and Application Servers on Azurev1Tech ED 2014   Running Oracle Databases and Application Servers on Azurev1
Tech ED 2014 Running Oracle Databases and Application Servers on Azurev1Brian Benz
 
Microsoft Offical Course 20410C_00
Microsoft Offical Course 20410C_00Microsoft Offical Course 20410C_00
Microsoft Offical Course 20410C_00gameaxt
 
Sql training
Sql trainingSql training
Sql trainingpremrings
 
Andrewfraserdba.com training sql_training
Andrewfraserdba.com training sql_trainingAndrewfraserdba.com training sql_training
Andrewfraserdba.com training sql_trainingmark jerald Canal
 
All about Kerberos In Microsoft BI
All about Kerberos In Microsoft BIAll about Kerberos In Microsoft BI
All about Kerberos In Microsoft BIPARIKSHIT SAVJANI
 
SQL ON Azure (decision-matrix)
SQL  ON  Azure (decision-matrix)SQL  ON  Azure (decision-matrix)
SQL ON Azure (decision-matrix)PARIKSHIT SAVJANI
 
PASS VC: SQL Server Performance Monitoring and Baselining
PASS VC: SQL Server Performance Monitoring and BaseliningPASS VC: SQL Server Performance Monitoring and Baselining
PASS VC: SQL Server Performance Monitoring and BaseliningPARIKSHIT SAVJANI
 

What's hot (20)

SQL Server 2019 ctp2.2
SQL Server 2019 ctp2.2SQL Server 2019 ctp2.2
SQL Server 2019 ctp2.2
 
SQL Server 2016: Just a Few of Our DBA's Favorite Things
SQL Server 2016: Just a Few of Our DBA's Favorite ThingsSQL Server 2016: Just a Few of Our DBA's Favorite Things
SQL Server 2016: Just a Few of Our DBA's Favorite Things
 
Mysql Enterprise Edition Feature and Tools
Mysql  Enterprise Edition Feature and Tools Mysql  Enterprise Edition Feature and Tools
Mysql Enterprise Edition Feature and Tools
 
Adi Sapir ISUG 123 11/10/2012
Adi Sapir ISUG 123 11/10/2012Adi Sapir ISUG 123 11/10/2012
Adi Sapir ISUG 123 11/10/2012
 
SQL Explore 2012 - Meir Dudai: DAC
SQL Explore 2012 - Meir Dudai: DACSQL Explore 2012 - Meir Dudai: DAC
SQL Explore 2012 - Meir Dudai: DAC
 
ZK MVVM, Spring & JPA On Two PaaS Clouds
ZK MVVM, Spring & JPA On Two PaaS CloudsZK MVVM, Spring & JPA On Two PaaS Clouds
ZK MVVM, Spring & JPA On Two PaaS Clouds
 
SQL server 2016 New Features
SQL server 2016 New FeaturesSQL server 2016 New Features
SQL server 2016 New Features
 
Sql server 2012 roadshow masd overview 003
Sql server 2012 roadshow masd overview 003Sql server 2012 roadshow masd overview 003
Sql server 2012 roadshow masd overview 003
 
Sql server-integration-services-ssis-step-by-step-sample-chapters
Sql server-integration-services-ssis-step-by-step-sample-chaptersSql server-integration-services-ssis-step-by-step-sample-chapters
Sql server-integration-services-ssis-step-by-step-sample-chapters
 
Windows azure sql_database_security_isug012013
Windows azure sql_database_security_isug012013Windows azure sql_database_security_isug012013
Windows azure sql_database_security_isug012013
 
Chinnasamy Manickam
Chinnasamy ManickamChinnasamy Manickam
Chinnasamy Manickam
 
Cause 2013: A Flexible Approach to Creating an Enterprise Directory
Cause 2013: A Flexible Approach to Creating an Enterprise DirectoryCause 2013: A Flexible Approach to Creating an Enterprise Directory
Cause 2013: A Flexible Approach to Creating an Enterprise Directory
 
Tech ED 2014 Running Oracle Databases and Application Servers on Azurev1
Tech ED 2014   Running Oracle Databases and Application Servers on Azurev1Tech ED 2014   Running Oracle Databases and Application Servers on Azurev1
Tech ED 2014 Running Oracle Databases and Application Servers on Azurev1
 
Microsoft Offical Course 20410C_00
Microsoft Offical Course 20410C_00Microsoft Offical Course 20410C_00
Microsoft Offical Course 20410C_00
 
Sql training
Sql trainingSql training
Sql training
 
Andrewfraserdba.com training sql_training
Andrewfraserdba.com training sql_trainingAndrewfraserdba.com training sql_training
Andrewfraserdba.com training sql_training
 
All about Kerberos In Microsoft BI
All about Kerberos In Microsoft BIAll about Kerberos In Microsoft BI
All about Kerberos In Microsoft BI
 
Where should I be encrypting my data?
Where should I be encrypting my data? Where should I be encrypting my data?
Where should I be encrypting my data?
 
SQL ON Azure (decision-matrix)
SQL  ON  Azure (decision-matrix)SQL  ON  Azure (decision-matrix)
SQL ON Azure (decision-matrix)
 
PASS VC: SQL Server Performance Monitoring and Baselining
PASS VC: SQL Server Performance Monitoring and BaseliningPASS VC: SQL Server Performance Monitoring and Baselining
PASS VC: SQL Server Performance Monitoring and Baselining
 

Similar to Continuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia

Integration Services Presentation V2
Integration Services Presentation V2Integration Services Presentation V2
Integration Services Presentation V2Catherine Eibner
 
Integration Services Presentation
Integration Services PresentationIntegration Services Presentation
Integration Services PresentationCatherine Eibner
 
Entity Framework Code First Migrations
Entity Framework Code First MigrationsEntity Framework Code First Migrations
Entity Framework Code First MigrationsDiluka99999
 
Azure DevOps for Developers
Azure DevOps for DevelopersAzure DevOps for Developers
Azure DevOps for DevelopersSarah Dutkiewicz
 
Azure DevOps for the Data Professional
Azure DevOps for the Data ProfessionalAzure DevOps for the Data Professional
Azure DevOps for the Data ProfessionalSarah Dutkiewicz
 
Enter the Dragon - SQL 2014 on Server Core PASS Summit 2014 Edition
Enter the Dragon -  SQL 2014 on Server Core PASS Summit 2014 EditionEnter the Dragon -  SQL 2014 on Server Core PASS Summit 2014 Edition
Enter the Dragon - SQL 2014 on Server Core PASS Summit 2014 EditionMark Broadbent
 
SQL Server 2008 Integration Services
SQL Server 2008 Integration ServicesSQL Server 2008 Integration Services
SQL Server 2008 Integration ServicesEduardo Castro
 
Apoyo en la administración de bases de datos mediante microsoft data tools
Apoyo en la administración de bases de datos mediante microsoft data toolsApoyo en la administración de bases de datos mediante microsoft data tools
Apoyo en la administración de bases de datos mediante microsoft data toolsSpanishPASSVC
 
Database CI Demo Using Sql Server
Database CI  Demo Using Sql ServerDatabase CI  Demo Using Sql Server
Database CI Demo Using Sql ServerUmesh Kumar
 
DWX 2023 - Datenbank-Schema Deployment im Kubernetes Release
DWX 2023 - Datenbank-Schema Deployment im Kubernetes ReleaseDWX 2023 - Datenbank-Schema Deployment im Kubernetes Release
DWX 2023 - Datenbank-Schema Deployment im Kubernetes ReleaseMarc Müller
 
Microsoft SQL Azure - Building Applications Using SQL Azure Presentation
Microsoft SQL Azure - Building Applications Using SQL Azure PresentationMicrosoft SQL Azure - Building Applications Using SQL Azure Presentation
Microsoft SQL Azure - Building Applications Using SQL Azure PresentationMicrosoft Private Cloud
 
A Primer To Sybase Iq Development July 13
A Primer To Sybase Iq Development July 13A Primer To Sybase Iq Development July 13
A Primer To Sybase Iq Development July 13sparkwan
 
Building & managing wa app wely
Building & managing wa app   welyBuilding & managing wa app   wely
Building & managing wa app welySpiffy
 
Building & Managing Windows Azure
Building & Managing Windows AzureBuilding & Managing Windows Azure
Building & Managing Windows AzureK.Mohamed Faizal
 

Similar to Continuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia (20)

Integration Services Presentation V2
Integration Services Presentation V2Integration Services Presentation V2
Integration Services Presentation V2
 
Integration Services Presentation
Integration Services PresentationIntegration Services Presentation
Integration Services Presentation
 
Database Schema Management & Deployment using SQL Server Data Tools (SSDT)
Database Schema Management & Deployment using SQL Server Data Tools (SSDT)Database Schema Management & Deployment using SQL Server Data Tools (SSDT)
Database Schema Management & Deployment using SQL Server Data Tools (SSDT)
 
Entity Framework Code First Migrations
Entity Framework Code First MigrationsEntity Framework Code First Migrations
Entity Framework Code First Migrations
 
Azure DevOps for Developers
Azure DevOps for DevelopersAzure DevOps for Developers
Azure DevOps for Developers
 
SSDT unleashed
SSDT unleashedSSDT unleashed
SSDT unleashed
 
Azure DevOps for the Data Professional
Azure DevOps for the Data ProfessionalAzure DevOps for the Data Professional
Azure DevOps for the Data Professional
 
Enter the Dragon - SQL 2014 on Server Core PASS Summit 2014 Edition
Enter the Dragon -  SQL 2014 on Server Core PASS Summit 2014 EditionEnter the Dragon -  SQL 2014 on Server Core PASS Summit 2014 Edition
Enter the Dragon - SQL 2014 on Server Core PASS Summit 2014 Edition
 
SQL Server 2008 Integration Services
SQL Server 2008 Integration ServicesSQL Server 2008 Integration Services
SQL Server 2008 Integration Services
 
Apoyo en la administración de bases de datos mediante microsoft data tools
Apoyo en la administración de bases de datos mediante microsoft data toolsApoyo en la administración de bases de datos mediante microsoft data tools
Apoyo en la administración de bases de datos mediante microsoft data tools
 
Database CI Demo Using Sql Server
Database CI  Demo Using Sql ServerDatabase CI  Demo Using Sql Server
Database CI Demo Using Sql Server
 
DWX 2023 - Datenbank-Schema Deployment im Kubernetes Release
DWX 2023 - Datenbank-Schema Deployment im Kubernetes ReleaseDWX 2023 - Datenbank-Schema Deployment im Kubernetes Release
DWX 2023 - Datenbank-Schema Deployment im Kubernetes Release
 
Microsoft SQL Azure - Building Applications Using SQL Azure Presentation
Microsoft SQL Azure - Building Applications Using SQL Azure PresentationMicrosoft SQL Azure - Building Applications Using SQL Azure Presentation
Microsoft SQL Azure - Building Applications Using SQL Azure Presentation
 
CV Chandrajit Samanta
CV Chandrajit SamantaCV Chandrajit Samanta
CV Chandrajit Samanta
 
A Primer To Sybase Iq Development July 13
A Primer To Sybase Iq Development July 13A Primer To Sybase Iq Development July 13
A Primer To Sybase Iq Development July 13
 
Day2
Day2Day2
Day2
 
Vs2005p
Vs2005pVs2005p
Vs2005p
 
Building & managing wa app wely
Building & managing wa app   welyBuilding & managing wa app   wely
Building & managing wa app wely
 
Building & Managing Windows Azure
Building & Managing Windows AzureBuilding & Managing Windows Azure
Building & Managing Windows Azure
 
Ow
OwOw
Ow
 

Recently uploaded

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

Continuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia

  • 1. Continuous Integration and the Data Warehouse Dr. John Tunnicliffe Independent BI Architect & Hands-On Developer Mobile: +44 7771 818770 john@bovi.co.uk Blog: http://sqlblogcasts.com/blogs/drjohn/
  • 2. Agenda  What is CI?  SQL Server Data Tools (SSDT)  PowerShell and psake build tools  TeamCity Build Server  Nbi Test framework  SSDT and T4 Templates
  • 3. Different approaches to SQL database development Migration Scripts  Manually prepare upgrade scripts  Must be run in correct order  Scripts are combination of DDL and data fixes  Manual deployment Declarative Model  Define what we want  Tool creates migration scripts  Still need data fixes  Automated deployments
  • 4. Hands up  Who has entire BI solution under source code control?  Including SQL databases, all SSIS packages, all SSAS cubes  SSDT and the declarative model approach?  Who already uses CI in a data warehouse context?  Does CI also deploy & test your code?
  • 5. What is Continuous Integration? Continuous Integration is a development practice that requires developers to integrate code into a shared repository several times a day. Each check-in is verified by an automated build, deploy and test cycle which allows errors to be detected and thereby corrected quickly.
  • 6. Benefits of Continuous Integration  Eradication of manual integrations and deployments  Catches issues fast  Reduces production & staging errors  Automated testing provides quality assurance  CI allows developers to proceed with confidence  CI provides reporting on quality of the code base  Facilitates Continuous Delivery
  • 7. Applying CI to the Data Warehouse Why is it so difficult?  BI developers are not familiar with CI  Never seen it in action in a DWH context  Not familiar with the tools and techniques  Cannot comprehend how it can be applied  Data is a BIG barrier  PROD data is different to DEV  Problems often only manifest themselves in PROD data  Time taken to load data
  • 8. Data Warehouse  Project started 2010  SQL 2008 R2 – tools & techniques have remained static  Various “initiatives” have resulted in a confused data architecture  Three competing data streams and lots of data marts  Overly complicated and complex!  100,000 files in the code-base!  14 database, 200 SSIS packages, 4 multidimensional cubes  7 developers, 4 testers, 3 BAs, 1 S2T, 1 DBA, 1 PM  Each database had 2 VSDT projects – split “storage” and “code”  Configuration scattered across code base  Manual build and very manual deploy – 1 guy, 4 days per month!  Each production release was getting longer, complex and error prone!
  • 9. Data Warehouse  Imported all databases into SQL Server Data Tools  New SCC repository with simplified structure: only 8,900 files  PowerShell script written to do local build & deployment  Development tools  Visual Studio 2013 for SQL Server Data Tools (SSDT)  Visual Studio 2008 for SSIS and SSAS (servers still SQL 2008R2)  TeamCity build server  Creates single Nuget package containing all 14 databases, 200+ SSIS package and SSAS cubes plus deployment scripts  Automatically deploys and tests everything  Automatic deployment to test, UAT and other environments!
  • 10. Key Considerations for CI  Deployable artifacts  What is generated from the code that I can deploy?  Deployment  How do I deploy the artifact?  Configuration  How can I set up the environment so that everything works?
  • 11. Tools and techniques for CI Source Code Control (SCC)  ALL code MUST be under Source Code Control  SQL Server, SSIS, BIML, SSAS, SSRS, Test Suites etc. etc.  Recommend Using Three Branches 1. Development branch 2. Release branch 3. Prod branch  SCC Locking strategy:  Use optimistic locking for SQL, C#  Use pessimistic locking for SSIS, SSAS and SSRS
  • 12. SQL Server Data Tools  Declarative model design environment for SQL Server  Requires Visual Studio 2012+  Supports SQL Server 2005+  Very easy to import an existing database  Must replace hard-coded database names with variables  Add references to other databases and setup SQLCmd variables  Don’t upgrade VSDT projects  Instead start a new SSDT project and import a deployed database instance  Then transfer over pre- and post-deploy scripts
  • 14. SQL Server Data Tools Adding a Database Reference
  • 15. SQL Server Data Tools Publishing your database
  • 16. SQL Server Data Tools DAC Publish Profile
  • 17. SQL Server Data Tools  Build generates a DACPAC => “deployable artifact”  Contains entire database model  Conforms to Open Packaging Convention = ZIP file!  Use MsBuild to create DACPAC from solutions  Use SQLPackage.exe to deploy DACPAC
  • 18. The many actions of SQLPackage.exe  Publish  Deploys a DACPAC  Script  Generates a T-SQL deployment script from a DACPAC  Extract  Creates a DACPAC from a database  Export  Creates a BACPAC  Import  Imports a BACPAC  DeployReport  List of changes new deploy will make  DriftReport  List of changes since last deploy
  • 19. PowerShell  PowerShell is the “glue” for your CI project  Part of Windows Management Framework  4.0 built into Windows Server 2012 R2 and Windows 8.1  Download and install WMF 4.0 for prior OS versions  Advanced scripting  Proper error handling Try-Catch  Easy to read/write XML  Ideal for dynamically generation of config files  CmdLets  Invoke-SQLCmd  Invoke-ASCmd & SQLAS
  • 20. psake  Task-orientated build tool written in PowerShell  Uses a dependency pattern similar to MSBuild or Make  Download from https://github.com/psake/psake  Build script consist of Tasks  Each task can depend on other tasks
  • 21. Tools and techniques for CI psake
  • 22. PowerShell Where to Start  Create a DeployConfig.xml file  Describes your server environment  Maps databases to servers, solutions to databases  Develop PowerShell functions to read config file  Dynamically build SQLCmd variables to pass into:  DAC Publish profiles  Invoke-SQLCmd  Post-Load Data Fix Scripts  User permission scripts  SSIS Configurations / SQL Agent Jobs  Dynamically create Nuget spec XML  Package your build
  • 25. Workflow 1. Build Release Pack – Nuget package containing  SQL databases, SSIS packages, SSAS cubes, etc. 2. Deploy Release Pack to Build Server  Run post-deployment tests  Unit tests on stored procs, functions, triggers  Check database model, cube model, defaults 3. Restore Cut-Down dataset and Load  Execute SSIS Packages / Load Cube  Run Post-Load Tests  Reconcile SSAS cube with SQL database  Regression tests  Fixed data set data checks
  • 29. Notifier  Tray icon  Notifies developers of broken builds  Pops up dialog  Links to TeamCity web site
  • 31. Tools and techniques for CI SSIS Artifacts  File Mode Deployment (pre-2012)  Build does nothing useful!  SSIS package => “deployable artifact”  Deployment simply copies packages into target location  File Mode Configuration  Update Package Configurations using PowerShell to:  Update XML config  Set SQLCmd variables and run a SQLCmd script which updates the SSIS configuration table
  • 32. Tools and techniques for CI SSIS Artifacts  Project Mode Deployment (SQL Server 2012+)  Build generates an ISPAC => “deployable artifact”  Use IsDeploymentWizard.exe to deploy the packages  Project Mode Configuration  Use SSISDB catalog stored procedures to:  Create Projects & Folders  Create Environments & Variables  etc.  Run as SQLCmd script from PowerShell
  • 33. SSAS Artifacts  Build  Cannot be done with MsBuild!  Must invoke Visual Studio (devenv.exe) to perform build  Windows EXE => so pipe to Out-Null to force PowerShell to wait  Generates a .AsDatabase file => “deployable artifact”  Deploy  Microsoft.AnalysisServices.Deployment.exe /s  PowerShell to generate XML config files defining target server etc.  Windows EXE => so pipe to Out-Null to force PowerShell to wait  SSAS Partition Manager  Deploys using AMO and also dynamically creates partitions  SsasPartitionManager.codeplex.com
  • 34. NBi Test Suite  Open source framework to test your BI solutions  Tests run using NUnit GUI or command-line runner  Tests written in XML  Can be dynamically manipulated using PowerShell  Automatic generation of tests via:  Tools provided with NBi suite – GenBI and GenBIL  SELECT … FOR XML  PowerShell etc.  Run SQL, MDX and DAX queries  Extract queries from SSRS reports  Run SSIS packages and check “side effects”  Check model structure
  • 35. NBi Test Suite  Extensive support for testing the model structure
  • 36. NBi Test Suite  Compare results of a query  Static data set  CSV  Results of another query  Check datatypes, nulls, empty strings, format etc.  Apply tolerance and rounding  Validate SQL query syntax  Performance tests  Clear the cache in test setup  Check cube member count, ordering, existence etc.
  • 39. Unit Testing with SSDT  Add a Unit Test C# project to your SSDT solution
  • 40. Code Analysis with SSDT  T-SQL Design Issues  Checks for code that might not behave the way you expect  Deprecated syntax  Issues that could cause problems in the design  T-SQL Naming Issues  Naming issues arise when a database object violates generally accepted conventions  T-SQL Performance Issues  Code that might noticeably reduce speed of database operations  Extensible model  Write your own Code Analysis
  • 41. Top tips to using SSDT & CI  No User Permissions  Database roles only  Assign Windows Groups to Roles in a post-deploy script  Don’t deploy SQL Agent Jobs to CI server  Use PowerShell to call the commands instead  Hold SSIS configuration scripts outside SSDT  Hold pre- and post-deploy data fix scripts external to SSDT in a “release” folder
  • 42. SSDT + T4 Templates  T4 = Text Template Transformation Toolkit  Built into Visual Studio 2005+  Create code from code  Example: History tables and triggers  Old data should be written to a history table every time an update done to the main table  Problem: 200 main tables = 200 history tables + 200 triggers
  • 43. SSDT + T4 Templates  Three ways you could implement T4 Templates 1. Use ADO.NET to query catalog views on a materialized (deployed) copy of the database 2. Use the Data-tier Application Framework (DACFx) to query the content of the DACPAC generated by SSDT on your last build 3. Use the Data-tier Application Framework (DACFx) to query the in-memory content of your SSDT project  Very few examples  Download my toolkit from t4dacfx2tsql.codeplex.com  Read my blog on http://sqlblogcasts.com/blogs/drjohn/
  • 44. Download my toolkit from t4dacfx2tsql.codeplex.com
  • 45. Continuous Integration and the Data Warehouse Dr. John Tunnicliffe Independent BI Architect & Hands-On Developer Mobile: +44 7771 818770 john@bovi.co.uk Blog: http://sqlblogcasts.com/blogs/drjohn/