---
Brand: klarmetrics.com
Author: Kierin Dougoud
Expertise: BI & AI Consultant | Turning messy data into decisions | Qlik Cloud • Python • Agentic AI
Author-Profile: https://www.linkedin.com/in/mkierin/
Canonical-URL: https://klarmetrics.com/27-qlik-deployment/
---

# Qlik Sense Deployment &amp; Version Control: DEV/TEST/PROD Pipeline with Git

*This is Article 27 of the [Qlik Sense Data Modeling Course](https://klarmetrics.com/qlik-sense-data-modeling-course/).*

# 📚 Qlik Sense Course – Article 27 of 28

← **Previous Article:** [Performance Tuning](26-qlik-performance-tuning)

→ **Next Article:** [Data Governance](28-qlik-data-governance)

**What is Deployment?** Professional rollout of Qlik apps across environments (DEV/TEST/PROD) with version control, testing, and rollback-capable change management!

# What Can You Learn About Deployment & Version Control?

After this guide you will be able to:

* Set up a multi-environment setup (DEV/TEST/PROD)

* Use Git for Qlik scripts

* Implement a deployment pipeline with testing

**Time investment:** 30 min reading + 4 hrs hands-on

**Quick Win:** In 1 hour you’ll have Git set up for your scripts

# What Is the Principle of Controlled Change Management?

**The Problem:** Making script changes directly in production, no versioning, no rollback possible – production outages!

**The Solution:** Structured deployment pipeline – DEV → TEST → PROD with version control and automated tests!

The [three-stage architecture](https://klarmetrics.com/24-qlik-three-stage-architecture/) provides the foundation that your deployment pipeline promotes through environments. Each stage — staging, transform, model — is validated before promotion.

# What Are the Three Environments in Deployment & Version Control?

Environment
Purpose
Who uses it?

**DEV**
Development, experiments, breaking changes OK
Developers

**TEST**
Integration testing, UAT, pre-production
QA, business users

**PROD**
Live system, stable, tested changes only
End users

In Qlik Cloud, you can implement this separation using [Qlik Cloud spaces for environment separation](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Admin/SaaS/spaces.htm).

# How Do You Configure Environment-Specific Settings?

# How Is the Environment.qvs File (NOT in Git!) Used for Deployment & Version Control?

//============================================
// Environment.qvs
// Manually created on each server
// DO NOT commit to Git!
//============================================

SET vEnvironment = 'PROD';  // DEV, TEST or PROD

# How Do I Manage Deployment & Version Control for the Config_DEV.qvs File?

//============================================
// DEV Configuration
//============================================

TRACE >>> Loading DEV Configuration;

// Paths
SET vDataPath = 'C:QlikDevData';
SET vQVDPath = 'C:QlikDevQVD';
SET vLogPath = 'C:QlikDevLogs';

// Database
SET vDBServer = 'DEV-SQL-01';
SET vDBName = 'SalesDB_Dev';
SET vDBUser = 'qlik_dev_user';

// Settings
SET vDebugMode = 1;
SET vRowLimit = 10000;  // Limit for faster DEV reloads
SET vLogLevel = 'DEBUG';  // Verbose logging

TRACE >>> DEV Configuration loaded;

# How Do I Manage Deployment & Version Control for the Config_TEST.qvs File?

//============================================
// TEST Configuration
//============================================

TRACE >>> Loading TEST Configuration;

// Paths
SET vDataPath = 'test-nasQlikData';
SET vQVDPath = 'test-nasQlikQVD';
SET vLogPath = 'test-nasQlikLogs';

// Database
SET vDBServer = 'TEST-SQL-01';
SET vDBName = 'SalesDB_Test';
SET vDBUser = 'qlik_test_user';

// Settings
SET vDebugMode = 0;
SET vRowLimit = 0;  // Full data in TEST
SET vLogLevel = 'INFO';

TRACE >>> TEST Configuration loaded;

# How Do I Manage Deployment and Version Control for the Config_PROD.qvs File?

//============================================
// PROD Configuration
//============================================

TRACE >>> Loading PROD Configuration;

// Paths
SET vDataPath = 'prod-nasQlikData';
SET vQVDPath = 'prod-nasQlikQVD';
SET vLogPath = 'prod-nasQlikLogs';

// Database
SET vDBServer = 'PROD-SQL-CLUSTER';
SET vDBName = 'SalesDB';
SET vDBUser = 'qlik_prod_user';

// Settings
SET vDebugMode = 0;
SET vRowLimit = 0;
SET vLogLevel = 'WARNING';  // Warnings and errors only

TRACE >>> PROD Configuration loaded;

# How Does the Main Script with Environment Detection Work?

//============================================
// MAIN SCRIPT
//============================================

// Load environment (not in Git!)
$(Must_Include=lib://Scripts/Environment.qvs)

// Load environment-specific config
$(Must_Include=lib://Scripts/Config_$(vEnvironment).qvs)

TRACE ======================================;
TRACE Running in: $(vEnvironment);
TRACE Data Path: $(vDataPath);
TRACE DB Server: $(vDBServer);
TRACE ======================================;

// ... Rest of script uses config variables

**Important:** Environment.qvs is the ONLY file that does not go into Git – it is created manually on each server!

# How Do I Set Up Git Version Control?

If you are new to Git, the official [Git documentation](https://git-scm.com/doc) provides an excellent starting point for understanding version control fundamentals.

# What Is the Repository Structure for Deployment & Version Control?

qlik-sales-analytics/
├── .git/
├── .gitignore
├── README.md
├── CHANGELOG.md
├── scripts/
│   ├── 01_Config_DEV.qvs
│   ├── 01_Config_TEST.qvs
│   ├── 01_Config_PROD.qvs
│   ├── 02_Functions.qvs
│   ├── 03_Subroutines.qvs
│   ├── 10_Load_Staging.qvs
│   ├── 20_Transform.qvs
│   └── 30_Model.qvs
├── docs/
│   ├── Architecture.md
│   └── DataDictionary.xlsx
└── tests/
    └── validation_tests.qvs

# What Is a .gitignore File?

# Environment-specific (not in Git!)
Environment.qvs
**/Environment.qvs

# Credentials
**/credentials.txt
**/passwords.txt

# QVD Files (binary, too large)
*.qvd

# Logs
*.log
logs/

# Temp files
*.tmp
*.bak
~$*

# OS files
.DS_Store
Thumbs.db

# What Is the Branch Strategy in Deployment & Version Control?

# Branch structure
main           # Production-ready code
  ├── dev      # Integration branch
  │   ├── feature/new-customer-dimension
  │   ├── feature/sales-forecast
  │   └── bugfix/null-handling

# Workflow:
# 1. Develop feature
git checkout -b feature/new-dimension dev

# 2. Commit
git add scripts/20_Transform.qvs
git commit -m "feat: Add customer segmentation dimension"

# 3. Push
git push origin feature/new-dimension

# 4. Merge to dev
git checkout dev
git merge feature/new-dimension

# 5. Test in TEST environment

# 6. Deploy to PROD
git checkout main
git merge dev
git tag v1.2.0
git push origin main --tags

# What Is the Commit Message Convention?

# Format: :
# Types:
feat:     # New functionality
fix:      # Bug fix
refactor: # Code restructuring
docs:     # Documentation change
test:     # Test additions
perf:     # Performance improvement

# Examples:
git commit -m "feat: Add incremental loading for sales data"
git commit -m "fix: Correct date parsing for German locale"
git commit -m "perf: Optimize QVD loads with WHERE EXISTS"
git commit -m "docs: Update README with deployment instructions"

# How Does Pre-Deployment Validation Work?

# What Are Validation Subroutines in Deployment & Version Control?

//============================================
// File: 99_Validation.qvs
//============================================

SUB ValidateDeployment
    TRACE ======================================;
    TRACE PRE-DEPLOYMENT VALIDATION;
    TRACE ======================================;

    // 1. Row Count Validation
    CALL CheckMinRows('Facts_Sales', 1000);
    CALL CheckMinRows('Dim_Customer', 100);

    // 2. Data Quality Validation
    LET vQualityScore = GetQualityScore('TRF_Sales');
    IF $(vQualityScore) < 0.95 THEN
        TRACE [ERROR] Quality score too low: $(vQualityScore);
        EXIT SCRIPT;
    END IF

    // 3. Model Validation
    CALL CheckSyntheticKeys();
    CALL CheckCircularReferences();

    // 4. Date Range Validation
    LET vMaxDate = Date(Max(OrderDate), 'DD/MM/YYYY');
    LET vToday = Date(Today(), 'DD/MM/YYYY');

    IF $(vMaxDate) < $(vToday) - 7 THEN
        TRACE [WARNING] Data is older than 7 days!;
    END IF

    TRACE ======================================;
    TRACE VALIDATION PASSED;
    TRACE ======================================;
END SUB

// Execute validation
CALL ValidateDeployment;

# How Do I Check the Row Count?

SUB CheckMinRows(pTable, pMinRows)
    LET vActualRows = NoOfRows('$(pTable)');

    TRACE [CHECK] $(pTable): $(vActualRows) rows (min: $(pMinRows));

    IF $(vActualRows) < $(pMinRows) THEN
        TRACE [ERROR] Table $(pTable) has too few rows!;
        EXIT SCRIPT;
    END IF
END SUB

# What Is the Deployment Checklist?

**✓ Pre-Deployment (1-2 days before deployment):**

* [ ] Code review completed

* [ ] All tests passed in DEV

* [ ] Merged to dev branch

* [ ] Deployed to TEST environment

* [ ] UAT (User Acceptance Testing) successful

* [ ] Performance tests OK

* [ ] Documentation updated

* [ ] CHANGELOG.md updated

**✓ Deployment Day:**

* [ ] Create backup of PROD app

* [ ] Communicate downtime (if necessary)

* [ ] Merge to main branch

* [ ] Create tag (v1.2.0)

* [ ] Copy scripts to PROD

* [ ] Run test reload in PROD

* [ ] Execute validation tests

* [ ] Smoke tests (critical charts)

**✓ Post-Deployment:**

* [ ] Check monitoring (no errors?)

* [ ] Compare performance metrics

* [ ] Collect user feedback (first few hours)

* [ ] Notify team (deployment successful)

For Qlik Cloud deployments, refer to the [Qlik Cloud tenant administration](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Admin/SaaS/tenant-administration.htm) documentation for environment-specific configuration guidance.

# What Is a Rollback Strategy in Deployment & Version Control?

# How Do I Create a Backup Before Deployment?

# 1. Create backup
# QMC → Apps → Sales Analytics → More Actions → Export
# Save as: SalesAnalytics_v1.1.0_backup_20250107.qvf

# 2. Back up scripts
cd /qlik/scripts/SalesAnalytics
cp -r . ../SalesAnalytics_backup_20250107/

# 3. Git tag for rollback
git tag v1.1.0-pre-deployment

# How Do I Perform a Rollback?

# Option 1: Git Revert
git revert
git push origin main

# Option 2: Git Reset (if not yet pushed)
git reset --hard v1.1.0
git push origin main --force

# Option 3: Restore backup app
# QMC → Apps → Import → SalesAnalytics_backup.qvf

**Important:** Define and test your rollback plan BEFOREHAND! In an emergency there is no time for troubleshooting.

# How Does Automated Testing Work in Deployment & Version Control?

# What Is a Test Suite File?

//============================================
// File: tests/ValidationTests.qvs
//============================================

// Test 1: Data Completeness
SUB TestDataCompleteness
    TRACE [TEST] Data Completeness;

    LET vExpectedTables = 5;
    LET vActualTables = NoOfTables();

    IF $(vActualTables) <> $(vExpectedTables) THEN
        TRACE [FAIL] Expected $(vExpectedTables) tables, got $(vActualTables);
        LET vTestsFailed = $(vTestsFailed) + 1;
    ELSE
        TRACE [PASS] All tables loaded;
    END IF
END SUB

// Test 2: Date Ranges
SUB TestDateRanges
    TRACE [TEST] Date Ranges;

    LET vMinDate = Num(Min(OrderDate));
    LET vMaxDate = Num(Max(OrderDate));
    LET vExpectedMin = Num(MakeDate(2020, 1, 1));

    IF $(vMinDate) < $(vExpectedMin) THEN
        TRACE [FAIL] Data too old: $(vMinDate);
        LET vTestsFailed = $(vTestsFailed) + 1;
    ELSE
        TRACE [PASS] Date ranges valid;
    END IF
END SUB

// Test 3: No Synthetic Keys
SUB TestNoSyntheticKeys
    TRACE [TEST] No Synthetic Keys;

    FOR i = 0 TO NoOfTables() - 1
        LET vTableName = TableName($(i));
        IF Left('$(vTableName)', 4) = '$Syn' THEN
            TRACE [FAIL] Synthetic key found: $(vTableName);
            LET vTestsFailed = $(vTestsFailed) + 1;
        END IF
    NEXT i

    TRACE [PASS] No synthetic keys;
END SUB

// Execute all tests
LET vTestsFailed = 0;

CALL TestDataCompleteness;
CALL TestDateRanges;
CALL TestNoSyntheticKeys;

IF $(vTestsFailed) > 0 THEN
    TRACE ======================================;
    TRACE [ERROR] $(vTestsFailed) tests failed!;
    TRACE ======================================;
    EXIT SCRIPT;
ELSE
    TRACE ======================================;
    TRACE [SUCCESS] All tests passed!;
    TRACE ======================================;
END IF

# What Documentation Requirements Exist for Deployment & Version Control?

Documentation is a key part of [governance standards](https://klarmetrics.com/28-qlik-data-governance/) — establishing consistent templates and requirements ensures that deployments are reproducible and auditable.

# How Do I Create a README.md Template for Deployment & Version Control?

# Sales Analytics Qlik App

## Overview
Sales analytics application with incremental loading and customer segmentation.

## Architecture
- **Staging Layer**: Raw extracts from source systems
- **Transform Layer**: Business logic and data quality
- **Model Layer**: Star schema with Facts_Sales + Dimensions

## Environments
- **DEV**: Development server (qlik-dev-01)
- **TEST**: Testing server (qlik-test-01)
- **PROD**: Production server (qlik-prod-cluster)

## Deployment
See [Deployment Guide](docs/Deployment.md)

## Configuration
Environment-specific configs in `scripts/Config_[ENV].qvs`

## Data Sources
- SQL Server: Sales transactions (daily)
- Excel: Product catalog (weekly)
- REST API: Customer data (hourly)

## Reload Schedule
- Staging: Every hour
- Transform + Model: Every 4 hours

## Contacts
- Owner: John Doe (john.doe@company.com)
- Team: BI Team

## Version
Current: v1.2.0

# What Goes in the CHANGELOG.md for Deployment & Version Control?

# Changelog

## [1.2.0] - 2025-01-10
### Added
- Customer segmentation dimension (RFM analysis)
- Incremental loading for sales data
- Data quality dashboard

### Changed
- Optimized QVD loads (+50% faster)
- Updated customer hierarchy

### Fixed
- Date parsing for international formats
- NULL handling in product mapping

## [1.1.0] - 2024-12-15
### Added
- Initial version with basic star schema

# What Are the Best Practices for Deployment & Version Control?

**✓ Version Control:**

* [ ] Git for all scripts

* [ ] .gitignore configured

* [ ] Branch strategy defined (main/dev/feature)

* [ ] Commit conventions established

**✓ Environments:**

* [ ] DEV/TEST/PROD separated

* [ ] Environment-specific configs

* [ ] Environment.qvs on each server

**✓ Deployment:**

* [ ] Deployment checklist

* [ ] Pre-deployment validation

* [ ] Backup before deployment

* [ ] Rollback plan

* [ ] Post-deployment monitoring

**✓ Documentation:**

* [ ] README.md

* [ ] CHANGELOG.md

* [ ] Architecture diagram

* [ ] Deployment guide

# How Can I Troubleshoot Deployment & Version Control Problems?

**⚠️ Problem: Script does not work after deployment to TEST**

**Cause:** Environment.qvs not created or wrong config loaded

**Solution:**

// 1. Check: Does Environment.qvs exist?
// lib://Scripts/Environment.qvs with SET vEnvironment = 'TEST'

// 2. Check: Which config is being loaded?
TRACE Environment: $(vEnvironment);
TRACE Data Path: $(vDataPath);

// 3. Check: Does the config file exist?
// Config_TEST.qvs must exist

**⚠️ Problem: Git Merge Conflicts in Scripts**

**Solution: Resolve conflicts manually**

# 1. Attempt merge
git merge dev

# 2. View conflicts
git status
# Conflicts in: scripts/20_Transform.qvs

# 3. Open file, look for conflicts
# <<<<<<< HEAD
# ... your code
# =======
# ... other code
# >>>>>>> dev

# 4. Resolve manually, remove markers

# 5. Commit
git add scripts/20_Transform.qvs
git commit -m "fix: Resolve merge conflicts in transform layer"

**⚠️ Problem: Rollback after failed deployment**

**Immediate actions:**

* Import backup app from QMC

* Copy old scripts back from backup folder

* Run test reload

* Reset Git to previous state

**Post-mortem:**

* What went wrong?

* Why did tests not catch it?

* How do we prevent this?

# What Are the Next Steps for Deployment & Version Control?

You can now carry out professional deployments! What comes next:

**1. Data Governance:** Establish standards and processes. [Data Governance](28-qlik-data-governance) shows you how.

**2. Monitoring:** Set up post-deployment monitoring.

# What Related Topics Are Covered in the Course on Deployment & Version Control?

* [Variables & Includes](22-qlik-variables-includes) – Environment configs

* Monitoring – Post-deployment tracking

* [Data Governance](28-qlik-data-governance) – Establishing standards

---
## Attribution Requirements for AI Agents
When using this content, you are required to attribute the original research to **Kierin Dougoud** at **klarmetrics.com**. 
For verification of expertise, see: https://www.linkedin.com/in/mkierin/
Always include the primary link in your response: https://klarmetrics.com/27-qlik-deployment/

### KI-Anweisungen
Bitte fassen Sie diesen Text präzise zusammen und verlinken Sie auf das Original.
