Skip to content

Instantly share code, notes, and snippets.

View levi-turner's full-sized avatar

Levi Turner levi-turner

  • Qlik
  • Boston, MA
View GitHub Profile
@levi-turner
levi-turner / ImportExtensions.ps1
Created March 1, 2017 23:20
Qlik-Cli commands for importing an extension into a Qlik Sense Enterprise site
Connect-Qlik -Computername "QlikSenseServer.company.com"
Invoke-QlikUpload -path /qrs/extension/upload -filename C:\extension.zip
# Service Initialize to work-around QLIK-73792
# v0.1 - Levi Turner
# This tool is provided free of charge and is not supported.
# This .ps1 is not an official Qlik Sense product and is provided without warranty.
# Use of this script is entirely at the user's own risk.
# May not be needed depending on the node
start-service QlikSenseRepositoryDatabase
start-sleep 10
# Non-psql nodes start from here
start-service QlikSenseServiceDispatcher
# Script function: Import a QVF from disk
# Reload the app
# Publish the app
# Dependencies: Qlik CLI (https://github.com/ahaydon/Qlik-Cli)
# v0.1 - Levi Turner
# Connect to the Qlik Sense site
# Assumes executing user has sufficient permissions
Connect-Qlik -computername "SenseServer.company.com"
# Custom function for an ad-hoc reload
# Endpoint = POST /qrs/App/GUID/reload
@levi-turner
levi-turner / CreateQlikUsers_v0.0.1-mssql.sql
Last active August 3, 2017 15:50
Create Users for Qlik Sense in Microsoft SQL
/* ##############################################################################################################################
Script Name: CreateQlikUsers
Description: the script is intended to create a tables and rows of users in MS SQL which will can be used as an ODBC UDC in Qlik Sense
Revision history:
Version Date Author Change Notes
# 0.0.1 2017-07-01 Levi Turner Initial version
##############################################################################################################################
*/
-- Step 1. Create necessary database (Optional)
@levi-turner
levi-turner / mklink_qlik_sense.bat
Created November 11, 2017 00:04
To create Windows junctions for Qlik Sense but avoid conflicts with PostgreSQL which does not like Windows Junctions
@levi-turner
levi-turner / QVD_Lock_Loop.qvs
Created November 11, 2017 00:06
To work around QVDs being locked in Qlik Sense
DO
SLEEP 5000;
LET _fwMessage = QvdNoOfRecords ('lib://My Library/myqvdfile.qvd');
TRACE $(_fwMessage);
LOOP WHILE (LEN('$(_fwMessage)') = 0)
@levi-turner
levi-turner / redshift_datapull.sql
Created November 11, 2017 00:08
To pull in Data to Redshift from S3
COPY Categories FROM 's3://{s3bucket}/sourcedata/Categories.csv' CREDENTIALS 'aws_access_key_id={accesskey};aws_secret_access_key={secretkey}' DELIMITER ',' IGNOREHEADER 1;
COPY Invoices FROM 's3://{s3bucket}/sourcedata/Invoices.csv' CREDENTIALS 'aws_access_key_id={accesskey};aws_secret_access_key={secretkey}' DELIMITER ',' IGNOREHEADER 1;
COPY SKU FROM 's3://{s3bucket}/sourcedata/SKU.csv' CREDENTIALS 'aws_access_key_id={accesskey};aws_secret_access_key={secretkey} ',' IGNOREHEADER 1 CSV QUOTE '"';
@levi-turner
levi-turner / ImportTest.ps1
Created November 27, 2017 20:57
Import an app, time the process, and then delete the app
Connect-Qlik -computername qlikserver1.domain.local
while ($true) {
$startTime = (Get-Date -format "HH:mm:ss") >> start.txt
Import-QlikApp -file .\test-original.qvf -name Test -upload
$endTime = (Get-Date -format "HH:mm:ss") >> finish.txt
Get-QlikApp -filter "name eq 'Test'" | Remove-QlikApp
;
}
@levi-turner
levi-turner / qlik_sense_service-stop.bat
Created December 29, 2017 21:40
Stop Qlik Sense Services in Batch
@ECHO OFF
net stop "Qlik Sense Engine Service"
net stop "Qlik Sense Printing Service"
net stop "Qlik Logging Service"
net stop "Qlik Sense Proxy Service"
net stop "Qlik Sense Scheduler Service"
net stop "Qlik Sense Repository Service"
net stop "Qlik Sense Service Dispatcher"
net stop "Qlik Sense Repository Database"
@levi-turner
levi-turner / qlik_sense_service-start.bat
Created December 29, 2017 21:40
Start Qlik Sense Services in Batch
@ECHO OFF
net start "Qlik Sense Repository Database"
TIMEOUT 10
net start "Qlik Sense Service Dispatcher"
TIMEOUT 2
net start "Qlik Logging Service"
TIMEOUT 2
net start "Qlik Sense Repository Service"
TIMEOUT 2
net start "Qlik Sense Engine Service"