qe-api-client 2.2.0__tar.gz → 2.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/PKG-INFO +6 -3
  2. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/README.md +5 -2
  3. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/qe_api_client/api_classes/engine_app_api.py +17 -6
  4. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/qe_api_client/engine.py +50 -0
  5. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/qe_api_client/structs.py +5 -1
  6. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/qe_api_client.egg-info/PKG-INFO +6 -3
  7. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/qe_api_client.egg-info/SOURCES.txt +0 -1
  8. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/setup.py +1 -1
  9. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/test/test_field_api.py +4 -12
  10. qe_api_client-2.2.0/qe_api_client/engine_helper.py +0 -67
  11. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/LICENSE +0 -0
  12. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/qe_api_client/__init__.py +0 -0
  13. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/qe_api_client/api_classes/__init__.py +0 -0
  14. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/qe_api_client/api_classes/engine_field_api.py +0 -0
  15. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/qe_api_client/api_classes/engine_generic_dimension_api.py +0 -0
  16. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/qe_api_client/api_classes/engine_generic_measure_api.py +0 -0
  17. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/qe_api_client/api_classes/engine_generic_object_api.py +0 -0
  18. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/qe_api_client/api_classes/engine_generic_variable_api.py +0 -0
  19. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/qe_api_client/api_classes/engine_global_api.py +0 -0
  20. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/qe_api_client/engine_communicator.py +0 -0
  21. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/qe_api_client.egg-info/dependency_links.txt +0 -0
  22. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/qe_api_client.egg-info/requires.txt +0 -0
  23. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/qe_api_client.egg-info/top_level.txt +0 -0
  24. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/setup.cfg +0 -0
  25. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/test/test_app_api.py +0 -0
  26. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/test/test_global_api.py +0 -0
  27. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/test/test_labs.py +0 -0
  28. {qe_api_client-2.2.0 → qe_api_client-2.3.0}/test/test_pyqlikengine.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qe-api-client
3
- Version: 2.2.0
3
+ Version: 2.3.0
4
4
  Summary: Python wrapper around Qlik Engine JSON API
5
5
  Home-page: https://github.com/lr-bicc/qe-api-client
6
6
  Author: Rumen Vasilev
@@ -28,7 +28,7 @@ Forked from [jhettler/pyqlikengine](https://github.com/jhettler/pyqlikengine)
28
28
  pip install qe-api-client
29
29
  ```
30
30
 
31
- ## Example of usage on Qlik Sense Enterprise Server
31
+ ## Connecting to Qlik Sense Enterprise Server
32
32
  You need to export the Qlik Sense certificates in PEM format from the Qlik Sense Enterprise server to a local folder in
33
33
  order to authenticate on the server.
34
34
 
@@ -48,7 +48,7 @@ qixe = QixEngine(url=url, user_directory=user_directory, user_id=user_id, ca_cer
48
48
  print(qixe.ega.get_doc_list())
49
49
  ```
50
50
 
51
- ## Example of usage on Qlik Sense Desktop
51
+ ## Connecting to Qlik Sense Desktop
52
52
  You need to start your Qlik Sense Desktop client on your local PC.
53
53
 
54
54
  ```python
@@ -61,5 +61,8 @@ qixe = QixEngine(url=url)
61
61
  print(qixe.ega.get_doc_list())
62
62
  ```
63
63
 
64
+ ## Examples of usage
65
+ Please click on this [link](https://github.com/lr-bicc/qe-api-client/tree/master/examples) to find examples of usage of this client.
66
+
64
67
  ## API reference
65
68
  Please click on this [link](https://lr-bicc.github.io/qe-api-client) for full API reference documentation .
@@ -13,7 +13,7 @@ Forked from [jhettler/pyqlikengine](https://github.com/jhettler/pyqlikengine)
13
13
  pip install qe-api-client
14
14
  ```
15
15
 
16
- ## Example of usage on Qlik Sense Enterprise Server
16
+ ## Connecting to Qlik Sense Enterprise Server
17
17
  You need to export the Qlik Sense certificates in PEM format from the Qlik Sense Enterprise server to a local folder in
18
18
  order to authenticate on the server.
19
19
 
@@ -33,7 +33,7 @@ qixe = QixEngine(url=url, user_directory=user_directory, user_id=user_id, ca_cer
33
33
  print(qixe.ega.get_doc_list())
34
34
  ```
35
35
 
36
- ## Example of usage on Qlik Sense Desktop
36
+ ## Connecting to Qlik Sense Desktop
37
37
  You need to start your Qlik Sense Desktop client on your local PC.
38
38
 
39
39
  ```python
@@ -46,5 +46,8 @@ qixe = QixEngine(url=url)
46
46
  print(qixe.ega.get_doc_list())
47
47
  ```
48
48
 
49
+ ## Examples of usage
50
+ Please click on this [link](https://github.com/lr-bicc/qe-api-client/tree/master/examples) to find examples of usage of this client.
51
+
49
52
  ## API reference
50
53
  Please click on this [link](https://lr-bicc.github.io/qe-api-client) for full API reference documentation .
@@ -79,7 +79,7 @@ class EngineAppApi:
79
79
  except KeyError:
80
80
  return response['error']
81
81
 
82
- def do_reload_ex(self, doc_handle, param_list=[]):
82
+ def do_reload_ex(self, doc_handle, param_list={}):
83
83
  """
84
84
  Triggers an extended reload of the app identified by the document handle.
85
85
 
@@ -91,10 +91,10 @@ class EngineAppApi:
91
91
  dict: The result of the extended reload operation. In case of an error, returns the error information.
92
92
  """
93
93
  msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": doc_handle, "method": "DoReloadEx",
94
- "params": param_list})
94
+ "params": {"qParams": param_list}})
95
95
  response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
96
96
  try:
97
- return response['result']
97
+ return response["result"]["qResult"]
98
98
  except KeyError:
99
99
  return response['error']
100
100
 
@@ -435,8 +435,9 @@ class EngineAppApi:
435
435
 
436
436
  # DoSave method: Saves an app - All objects and data in the data model are saved. # NOQA
437
437
  # Desktop only - server auto saves
438
- def do_save(self, doc_handle):
439
- msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": doc_handle, "method": "DoSave", "params": []})
438
+ def do_save(self, doc_handle, file_name=""):
439
+ msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": doc_handle, "method": "DoSave",
440
+ "params": {"qFileName": file_name}})
440
441
  response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
441
442
  try:
442
443
  return response['result']
@@ -666,7 +667,17 @@ class EngineAppApi:
666
667
 
667
668
  # GetAllInfos method: Get the identifier and the type of any generic object in an app by using the GetAllInfos method. # NOQA
668
669
  def get_lineage(self, doc_handle):
669
- msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": doc_handle, "method": "GetLineage", "params": []})
670
+ """
671
+ Gets the lineage information of the app. The lineage information includes the LOAD and STORE statements from
672
+ the data load script associated with this app.
673
+
674
+ Parameters:
675
+ doc_handle (int): The handle identifying the app document.
676
+
677
+ Returns:
678
+ list: Information about the lineage of the data in the app.
679
+ """
680
+ msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": doc_handle, "method": "GetLineage", "params": {}})
670
681
  response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
671
682
  try:
672
683
  return response['result']['qLineage']
@@ -90,12 +90,62 @@ class QixEngine:
90
90
  return self.efa.clear(fld_handle)
91
91
 
92
92
  def create_single_master_dimension(self, app_handle, dim_title, dim_def, dim_label):
93
+ """
94
+ Creates a single master dimension.
95
+
96
+ Parameters:
97
+ app_handle (int): The handle of the app.
98
+ dim_title (str): The title of the dimension.
99
+ dim_def (str): The definition of the dimension.
100
+ dim_label (str): The label of the dimension.
101
+
102
+ Returns:
103
+ dict: The handle and Id of the dimension.
104
+ """
93
105
  nx_info = self.structs.nx_info("dimension")
94
106
  lb_dim_def = self.structs.nx_library_dimension_def("N",[dim_def],[""],dim_label)
95
107
  gen_dim_props = self.structs.generic_dimension_properties(nx_info, lb_dim_def, dim_title)
96
108
  master_dim = self.eaa.create_dimension(app_handle, gen_dim_props)
97
109
  return master_dim
98
110
 
111
+ def create_master_measure(self, app_handle, mes_title, mes_def, mes_label):
112
+ """
113
+ Creates a master measure.
114
+
115
+ Parameters:
116
+ app_handle (int): The handle of the app.
117
+ mes_title (str): The title of the measure.
118
+ mes_def (str): The definition of the measure.
119
+ mes_label (str): The label of the measure.
120
+
121
+ Returns:
122
+ dict: The handle and Id of the measure.
123
+ """
124
+ nx_info = self.structs.nx_info("measure")
125
+ lb_mes_def = self.structs.nx_inline_measure_def(mes_def,mes_label)
126
+ gen_mes_props = self.structs.generic_measure_properties(nx_info, lb_mes_def, mes_title)
127
+ master_mes = self.eaa.create_measure(app_handle, gen_mes_props)
128
+ return master_mes
129
+
130
+ def get_app_lineage_info(self, app_handle):
131
+ """
132
+ Gets the lineage information of the app. The lineage information includes the LOAD and STORE statements from
133
+ the data load script associated with this app.
134
+
135
+ Parameters:
136
+ app_handle (int): The handle of the app.
137
+
138
+ Returns:
139
+ DataFrame: Information about the lineage of the data in the app.
140
+ """
141
+ # Lineage-Daten aus der API holen
142
+ lineage_info = self.eaa.get_lineage(app_handle)
143
+
144
+ # Erstelle den DataFrame und fülle fehlende Werte mit ""
145
+ df_lineage_info = pd.DataFrame(lineage_info)
146
+ df_lineage_info = df_lineage_info[(df_lineage_info["qDiscriminator"].notna()) | (df_lineage_info["qStatement"].notna())].fillna("")
147
+ return df_lineage_info
148
+
99
149
  def disconnect(self):
100
150
  self.conn.close_qvengine_connection(self.conn)
101
151
 
@@ -66,4 +66,8 @@ def num_format(type="U", n_dec=10, use_thou=0, fmt="", dec="", thou=""):
66
66
  return {"qType": type, "qnDec": n_dec, "qUseThou": use_thou, "qFmt": fmt, "qDec": dec, "qThou": thou}
67
67
 
68
68
  def generic_measure_properties(info, lb_meas_def, meas_title):
69
- return {"qInfo": info, "qMeasure": lb_meas_def, "qMetaDef": {"title": meas_title}}
69
+ return {"qInfo": info, "qMeasure": lb_meas_def, "qMetaDef": {"title": meas_title}}
70
+
71
+ def do_reload_ex_params(mode=0, partial=False, debug=False, reload_id="", skip_store=False, row_limit=0):
72
+ return {"qMode": mode, "qPartial": partial, "qDebug": debug, "qReloadId": reload_id, "qSkipStore": skip_store,
73
+ "qRowLimit": row_limit}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qe-api-client
3
- Version: 2.2.0
3
+ Version: 2.3.0
4
4
  Summary: Python wrapper around Qlik Engine JSON API
5
5
  Home-page: https://github.com/lr-bicc/qe-api-client
6
6
  Author: Rumen Vasilev
@@ -28,7 +28,7 @@ Forked from [jhettler/pyqlikengine](https://github.com/jhettler/pyqlikengine)
28
28
  pip install qe-api-client
29
29
  ```
30
30
 
31
- ## Example of usage on Qlik Sense Enterprise Server
31
+ ## Connecting to Qlik Sense Enterprise Server
32
32
  You need to export the Qlik Sense certificates in PEM format from the Qlik Sense Enterprise server to a local folder in
33
33
  order to authenticate on the server.
34
34
 
@@ -48,7 +48,7 @@ qixe = QixEngine(url=url, user_directory=user_directory, user_id=user_id, ca_cer
48
48
  print(qixe.ega.get_doc_list())
49
49
  ```
50
50
 
51
- ## Example of usage on Qlik Sense Desktop
51
+ ## Connecting to Qlik Sense Desktop
52
52
  You need to start your Qlik Sense Desktop client on your local PC.
53
53
 
54
54
  ```python
@@ -61,5 +61,8 @@ qixe = QixEngine(url=url)
61
61
  print(qixe.ega.get_doc_list())
62
62
  ```
63
63
 
64
+ ## Examples of usage
65
+ Please click on this [link](https://github.com/lr-bicc/qe-api-client/tree/master/examples) to find examples of usage of this client.
66
+
64
67
  ## API reference
65
68
  Please click on this [link](https://lr-bicc.github.io/qe-api-client) for full API reference documentation .
@@ -4,7 +4,6 @@ setup.py
4
4
  qe_api_client/__init__.py
5
5
  qe_api_client/engine.py
6
6
  qe_api_client/engine_communicator.py
7
- qe_api_client/engine_helper.py
8
7
  qe_api_client/structs.py
9
8
  qe_api_client.egg-info/PKG-INFO
10
9
  qe_api_client.egg-info/SOURCES.txt
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="qe-api-client",
8
- version="2.2.0",
8
+ version="2.3.0",
9
9
  author="Rumen Vasilev",
10
10
  author_email="R.Vasilev@LRWorld.com",
11
11
  description="Python wrapper around Qlik Engine JSON API",
@@ -1,14 +1,6 @@
1
1
  import unittest
2
-
3
- from qe_api_client.api_classes.engine_app_api import EngineAppApi
4
- from qe_api_client.engine_communicator import EngineCommunicator
5
- from qe_api_client.api_classes.engine_field_api import EngineFieldApi
6
- from qe_api_client.api_classes.engine_global_api import EngineGlobalApi
7
- import qe_api_client.structs as structs
8
2
  from qe_api_client.engine import QixEngine
9
3
 
10
- from qe_api_client.api_classes.engine_generic_object_api import EngineGenericObjectApi
11
-
12
4
 
13
5
  class TestFieldApi(unittest.TestCase):
14
6
 
@@ -24,14 +16,14 @@ class TestFieldApi(unittest.TestCase):
24
16
  self.qixe.eaa.do_reload_ex(self.app_handle)
25
17
 
26
18
  nx_inline_dimension_def = self.qixe.structs.nx_inline_dimension_def(["Alpha"])
27
- nx_page_initial = structs.nx_page(0, 0, 1, 26)
28
- lb_def = structs.list_object_def("$", "", nx_inline_dimension_def,[nx_page_initial])
19
+ nx_page_initial = self.qixe.structs.nx_page(0, 0, 1, 26)
20
+ lb_def = self.qixe.structs.list_object_def("$", "", nx_inline_dimension_def,[nx_page_initial])
29
21
 
30
22
  # Create info structure
31
- nx_info = structs.nx_info("ListObject", "SLB01")
23
+ nx_info = self.qixe.structs.nx_info("ListObject", "SLB01")
32
24
 
33
25
  # Create generic object properties structure
34
- gen_obj_props = structs.generic_object_properties(nx_info, "qListObjectDef", lb_def)
26
+ gen_obj_props = self.qixe.structs.generic_object_properties(nx_info, "qListObjectDef", lb_def)
35
27
  listobj = self.qixe.eaa.create_session_object(self.app_handle, gen_obj_props) # NOQA
36
28
 
37
29
  self.lb_handle = self.qixe.get_handle(listobj)
@@ -1,67 +0,0 @@
1
- import math
2
-
3
- from qe_api_client.api_classes.engine_app_api import EngineAppApi
4
- from qe_api_client.api_classes.engine_field_api import EngineFieldApi
5
- from qe_api_client.api_classes.engine_generic_object_api import EngineGenericObjectApi
6
- from qe_api_client.api_classes.engine_global_api import EngineGlobalApi
7
- import qe_api_client.structs as structs
8
-
9
- import pandas as pd
10
-
11
-
12
- def getDataFrame(connection, appHandle, measures, dimensions, selections={}):
13
- engineGlobalApi = EngineGlobalApi(connection)
14
- # Define Dimensions of hypercube
15
- hc_inline_dim = structs.nx_inline_dimension_def(dimensions)
16
-
17
- # Set sorting of Dimension by Measure
18
- hc_mes_sort = structs.sort_criteria()
19
-
20
- # Define Measure of hypercube
21
- hc_inline_mes = structs.nx_inline_measure_def(measures)
22
-
23
- # Build hypercube from above definition
24
- hc_dim = structs.nx_dimension(hc_inline_dim)
25
- hc_mes = structs.nx_measure("", hc_inline_mes, hc_mes_sort)
26
-
27
- width = len(measures) + len(dimensions)
28
- height = int(math.floor(10000 / width))
29
- nx_page = structs.nx_page(0, 0, width, height)
30
- hc_def = structs.hypercube_def("$", [hc_dim], [hc_mes], [nx_page])
31
-
32
- engineAppApi = EngineAppApi(connection)
33
- hc_response = engineAppApi.create_object(appHandle, "CH01", "Chart", "qHyperCubeDef", hc_def) # NOQA
34
- hc_handle = engineGlobalApi.get_handle(hc_response['qReturn'])
35
-
36
- engineGenericObjectApi = EngineGenericObjectApi(connection)
37
-
38
- engineFieldApi = EngineFieldApi(connection)
39
-
40
- for field in selections.keys():
41
- fieldHandle = engineGlobalApi.get_handle(engineAppApi.get_field(appHandle, field)) # NOQA
42
- values = []
43
- for selectedValue in selections[field]:
44
- values.append({'qText': selectedValue})
45
-
46
- engineFieldApi.select_values(fieldHandle, values)
47
-
48
- i = 0
49
- while i % height == 0:
50
- nx_page = structs.nx_page(0, i, width, height)
51
- hc_data = engineGenericObjectApi.get_hypercube_data(hc_handle, "/qHyperCubeDef", nx_page) # NOQA
52
- elems = hc_data["qDataPages"][0]['qMatrix']
53
-
54
- df = pd.DataFrame()
55
-
56
- for elem in elems:
57
- j = 0
58
- for dim in dimensions:
59
- df.set_value(i, dim, elem[j]["qText"])
60
- j += 1
61
- for meas in measures:
62
- df.set_value(i, meas, elem[j]["qNum"])
63
- j += 1
64
-
65
- i += 1
66
-
67
- return df
File without changes
File without changes