Check for New Data Connections *
Cadence Weekly
Sites production
Initial | Recurring | |
---|---|---|
Estimated Time | 5 Min | 5 min |
Benefits:
- Decrease redundancy
- Increase awareness
Goal
Checking for new data connections on a regular basis is one of the ways to help curb the amount of connections that exist in the environment. It allows for the ability to spot duplicates ahead of time, track what sources are being used, and catch any potential out-of-process additions. For a much deeper analysis of data connections, please refer to the Data Connection Analyzer.
Note
This page will outline two methods for accomplishing this activity (using the QMC and using a Qlik CLI for Windows script). The QMC approach is generally appropriate for most environments. The Qlik CLI for Windows approach is more appropriate for environments where automation is required.
Table of Contents
QMC - Data Connections
In the QMC, select Data Connections:
In the upper right hand side of the screen, select the Column selector, and then select the Connection String, Type, and Created columns.
Now select the filter icon for the Created column, and then select the filter of Last seven days, or the desired range.
Lastly, review the resulting table and view any new data connections.
Get List of New Data Connections (Qlik CLI for Windows)
The below script snippet requires the Qlik CLI for Windows.
The script will bring back any data connection with a Created Date that is greater than or equal to x days old. The script will then store the output into a desired location in either csv or json format.
Script
# Function to collect data connections that were created in the last x days
################
## Parameters ##
################
# Assumes default credentials are used for the Qlik CLI for Windows Connection
# machine name
$computerName = '<machine-name>'
# leave empty if windows auth is on default VP
$virtualProxyPrefix = '/default'
# set the number of days back for the app created date
$daysBack = 7
# directory for the output file
$filePath = 'C:\tmp\'
# desired filename of the output file
$fileName = 'new_data_connections'
# desired format of the output file (can be 'json' or 'csv')
$outputFormat = 'json'
################
##### Main #####
################
# create filePath
if (Test-Path $filePath) {
} else {
New-Item -ItemType directory -Path $filePath | Out-Null
}
# set the output file path
$outFile = ($filePath + $fileName + '_' + $(Get-Date -f "yyyy-MM-dd") + '.' + $outputFormat)
# set the date to the current time minus $daysback
$date = (Get-Date -date $(Get-Date).AddDays(-$daysBack) -UFormat '+%Y-%m-%dT%H:%M:%S.000Z').ToString()
# set the computer name for the Qlik connection call
$computerNameFull = ($computerName + $virtualProxyPrefix).ToString()
# connect to Qlik
Connect-Qlik -ComputerName $computerNameFull -UseDefaultCredentials -TrustAllCerts
# check the output format
# get all data connections that are created >= $date
# output results to $outfile
If ($outputFormat.ToLower() -eq 'csv') {
Get-QlikDataConnection -filter "createdDate ge '$date'" -full | ConvertTo-Csv -NoTypeInformation | Set-Content $outFile
} Else {
Get-QlikDataConnection -filter "createdDate ge '$date'" -full | ConvertTo-Json | Set-Content $outFile
}
Tags
#weekly
#asset_management
#data_connections