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


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
from airflow.utils.dates import days_ago

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-airflow',default_args=default_args,description='A simple tutorial DAG to try',schedule_interval=timedelta(days=1),start_date=days_ago(2),tags=['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
from airflow.utils.dates import days_ago

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',schedule_interval=timedelta(days=1),start_date=days_ago(2),tags=['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

airflow_provider_qlik_sense_cloud-0.0.8.tar.gz (14.2 kB view details)

Uploaded Source

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-0.0.8.tar.gz.

File metadata

File hashes

Hashes for airflow_provider_qlik_sense_cloud-0.0.8.tar.gz
Algorithm Hash digest
SHA256 5dcf37a3693fac8bd76fc0983063a03905375c792838cb888190729ae7925e59
MD5 deefe8131fd426d3892c796abfc438d9
BLAKE2b-256 803bbc202bb5d66ef0630ee56abeadce3f90be6933435367ad531323d34b9e4c

See more details on using hashes here.

File details

Details for the file airflow_provider_qlik_sense_cloud-0.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for airflow_provider_qlik_sense_cloud-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 856af7db5f02cede89331b8405ffa4f20ca341550fc0bb75fefa1580625ec2b2
MD5 8327362b1669dc74b18df0e355f65fc9
BLAKE2b-256 8beb4b95734ff5f9e0f82f93d9010479ae6d89421e852bd60fb3637011a69a39

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