Skip to main content

Airflow package provider to reload apps/task/automation from Qlik Sense Cloud.

Project description

qlik

Airflow: Qlik Sense Cloud Provider

Qlik Sense Cloud Provider to reload application, automation from Airflow.


This repository provides basic qlik sense cloud hook and operators to trigger reloads of applications, automations, or tasks available in a Qlik Sense Cloud tenant.

Road Map

In development:

☑ Adding Qlik Talend Cloud Operator (Waiting new tenant to add it)

Test-Phase:

☑ Adding Report Operator (Added in production) ☑ Comptability with Airflow 3.0.1 (Added in production)

Warnings

For version superior to Airflow 3.0.0, please use version superior to 0.0.7 For version below to Airflow 3.0.0, please use version under 0.0.7

Requirements

The package has been tested with Python 3.9.

Package Version
apache-airflow >2.10
qlik-sdk >= 0.14.0

You also need a Qlik Sense Cloud tenant with API key activated. To get more informations about how to activate API key on Qlik Sense Cloud Tenant, see this section.

How to install it ?

To install it, download and unzip source and launch the following pip install command:

By using Pypi

pip install airflow-provider-qlik-sense-cloud

By Local Install

pip install .

You can also use

python setup.py install

How to use it ?


To create connection, you need to get a API Token and your Qlik Cloud Tenant Activation


1. Generating API Keys

You can follow this video to generate an API Key or you'll find a step by step tutorial just below the video:

a. Youtube tutorial

Qlik Fix: How to Generate API Keys with APIs in Qlik Sense Enterprise SaaS

b. Step by step tutorial


Follow these steps to get API Keys:

Step 1: Login to your Qlik Sense Cloud Tenant.

Step 2: Click on your account logo and go into Profile.

parameters_demo

Step 3: Go into API keys section.

api_key


Step 4: Generate a new key.

generate_api_key_1


Step 5: Give a description and an expiration date ( ⚠️⚠️⚠️ Choose an expiration date with enough delay to avoid refresh all the time the token API ⚠️⚠️⚠️).

generate_api_key_2


Step 6: The API key is displaying, copy it and save it.

copyAPIKey



2. Get tenant id

Step 1: Login to your Qlik Sense Cloud Tenant and go into About Section by clicking on your profile icon.

about_tenant

Step 2: Get the value of your tenant hostname

QlikSenseCloudTenantId

3. Creating Qlik Sense Cloud Connection in Airflow

Step 1: Login to your Airflow Webserver. Go into Admin > Connection and creation a new connection by cliking on add icon.


Step 2: Give a name to your connection id and selection Qlik Sense Cloud in Connection Type. Add tenant id hostname (without https) and Token API Key that you copy in Section 1 and 2.

airflow_connection_illustration



4. Example: Creating a DAG with Qlik Sense Cloud Operator to reload App

You can now use the operators in your dags to trigger action in Qlik Sense Cloud from Airflow

Example:

from airflow import DAG
from airflow.providers.qlik_sense_cloud.operators.qlik_sense_cloud_reload import QlikSenseCloudReloadOperator
import pendulum
from datetime import timedelta
from textwrap import dedent


# [START default_args]
# These args will get passed on to each operator
# You can override them on a per-task basis during operator initialization
default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'email': ['airflow@example.com'],
    'email_on_failure': False,
    'email_on_retry': False,
    'retries': 1,
    'retry_delay': timedelta(minutes=5),
    'schedule_interval':'@daily',

    # 'queue': 'bash_queue',
    # 'pool': 'backfill',
    # 'priority_weight': 10,
    # 'end_date': datetime(2016, 1, 1),
    # 'wait_for_downstream': False,
    # 'dag': dag,
    # 'sla': timedelta(hours=2),
    # 'execution_timeout': timedelta(seconds=300),
    # 'on_failure_callback': some_function,
    # 'on_success_callback': some_other_function,
    # 'on_retry_callback': another_function,
    # 'sla_miss_callback': yet_another_function,
    # 'trigger_rule': 'all_success'
}
# [END default_args]


# [START instantiate_dag]
with DAG('test-airflow',
        default_args=default_args,
        description='A simple tutorial DAG to try',
        start_date=start_date=pendulum.datetime(2021, 1, 1, 10, 40, 0, tz="Europe/Paris"),tags=['qlik','example']) as dag:

        t1 = QlikSenseCloudReloadOperator(task_id='reload_app',appId='4d5ad6d0-92a1-47c3-b57d-5a07945377f8',qlik_sense_cloud_config_id='qliksensecloud')

        t1
# [END instantiate_dag]

5. Example: Creating a DAG with Qlik Sense Cloud Operator to reload Qlik Automation and to send a Qlik Report

Here's an example of DAG using operator to reload automation

from airflow import DAG
from airflow.providers.qlik_sense_cloud.operators.qlik_sense_cloud_automation import QlikSenseCloudAutomationOperator
from airflow.providers.qlik_sense_cloud.operators.qlik_sense_cloud_report import QlikSenseCloudReportOperator

import pendulum
from datetime import timedelta
from textwrap import dedent

# [START default_args]
# These args will get passed on to each operator
# You can override them on a per-task basis during operator initialization
default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'email': ['airflow@example.com'],
    'email_on_failure': False,
    'email_on_retry': False,
    'retries': 1,
    'retry_delay': timedelta(minutes=5),
    # 'queue': 'bash_queue',
    # 'pool': 'backfill',
    # 'priority_weight': 10,
    # 'end_date': datetime(2016, 1, 1),
    # 'wait_for_downstream': False,
    # 'dag': dag,
    # 'sla': timedelta(hours=2),
    # 'execution_timeout': timedelta(seconds=300),
    # 'on_failure_callback': some_function,
    # 'on_success_callback': some_other_function,
    # 'on_retry_callback': another_function,
    # 'sla_miss_callback': yet_another_function,
    # 'trigger_rule': 'all_success'
}
# [END default_args]


# [START instantiate_dag]
with DAG('test-automation-report',
        default_args=default_args,
        description='A simple tutorial DAG to try',
        start_date=start_date=pendulum.datetime(2021, 1, 1, 10, 40, 0, tz="Europe/Paris"),tags=['qlik','example']) as dag:
          
	t1 = QlikSenseCloudAutomationOperator(task_id='reload_automation',automationId='bab86470-578a-11ed-bee3-db20e15c9fd8',qlik_sense_cloud_config_id='qliksensecloud')

  	t2 = QlikSenseCloudReportOperator(task_id='reload_report',reportId='65f810a9e0f4697cb54b6e87',qlik_sense_cloud_config_id='qliksensecloud')

	t1 >> t2

6. (Appendix) Activate API Key on Qlik Sense Cloud Tenant

To get more informations about API Key in Qlik Sense Cloud, you can follow these topic:

https://qlik.dev/tutorials/generate-your-first-api-key

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file airflow-provider-qlik-sense-cloud-rac-0.0.1.tar.gz.

File metadata

File hashes

Hashes for airflow-provider-qlik-sense-cloud-rac-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9e4180ee5ade395b8092c322b4aec1c792a4c2331153d3d110100d726c648f38
MD5 73e0a3235ecab088e875c52e4a663884
BLAKE2b-256 d39f21697bb2896949eedf0e1b67a16f093284dab9d3f544051165d166d5d3c2

See more details on using hashes here.

File details

Details for the file airflow_provider_qlik_sense_cloud_rac-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for airflow_provider_qlik_sense_cloud_rac-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f641079afa7b7fe3a771106d75251f54830fba03830f67b60561271d908ab881
MD5 b4f15271bba60b70615471af691d208e
BLAKE2b-256 1f07649c8652f837cf055b78b8eea2bb080706a08cfceb82e677236bb4ac02da

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page