qe-api-client 2.2.0__tar.gz → 2.4.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.
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/PKG-INFO +17 -4
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/README.md +5 -2
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/engine_app_api.py +36 -6
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/qe_api_client/engine.py +50 -0
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/qe_api_client/engine_communicator.py +4 -13
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/qe_api_client/structs.py +10 -1
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/qe_api_client.egg-info/PKG-INFO +17 -4
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/qe_api_client.egg-info/SOURCES.txt +3 -1
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/qe_api_client.egg-info/requires.txt +1 -0
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/setup.py +3 -2
- qe_api_client-2.4.0/test/test.py +43 -0
- qe_api_client-2.4.0/test/test_api.py +52 -0
- qe_api_client-2.4.0/test/test_chart_content.py +17 -0
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/test/test_field_api.py +4 -12
- qe_api_client-2.2.0/qe_api_client/engine_helper.py +0 -67
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/LICENSE +0 -0
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/qe_api_client/__init__.py +0 -0
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/__init__.py +0 -0
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/engine_field_api.py +0 -0
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/engine_generic_dimension_api.py +0 -0
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/engine_generic_measure_api.py +0 -0
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/engine_generic_object_api.py +0 -0
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/engine_generic_variable_api.py +0 -0
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/engine_global_api.py +0 -0
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/qe_api_client.egg-info/dependency_links.txt +0 -0
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/qe_api_client.egg-info/top_level.txt +0 -0
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/setup.cfg +0 -0
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/test/test_app_api.py +0 -0
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/test/test_global_api.py +0 -0
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/test/test_labs.py +0 -0
- {qe_api_client-2.2.0 → qe_api_client-2.4.0}/test/test_pyqlikengine.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.2
|
2
2
|
Name: qe-api-client
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.4.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
|
@@ -12,6 +12,16 @@ Requires-Python: >=3.6
|
|
12
12
|
Description-Content-Type: text/markdown
|
13
13
|
License-File: LICENSE
|
14
14
|
Requires-Dist: websocket-client>=0.47.0
|
15
|
+
Requires-Dist: pandas>=2.2.0
|
16
|
+
Dynamic: author
|
17
|
+
Dynamic: author-email
|
18
|
+
Dynamic: classifier
|
19
|
+
Dynamic: description
|
20
|
+
Dynamic: description-content-type
|
21
|
+
Dynamic: home-page
|
22
|
+
Dynamic: requires-dist
|
23
|
+
Dynamic: requires-python
|
24
|
+
Dynamic: summary
|
15
25
|
|
16
26
|
# Qlik Engine API Client
|
17
27
|
|
@@ -28,7 +38,7 @@ Forked from [jhettler/pyqlikengine](https://github.com/jhettler/pyqlikengine)
|
|
28
38
|
pip install qe-api-client
|
29
39
|
```
|
30
40
|
|
31
|
-
##
|
41
|
+
## Connecting to Qlik Sense Enterprise Server
|
32
42
|
You need to export the Qlik Sense certificates in PEM format from the Qlik Sense Enterprise server to a local folder in
|
33
43
|
order to authenticate on the server.
|
34
44
|
|
@@ -48,7 +58,7 @@ qixe = QixEngine(url=url, user_directory=user_directory, user_id=user_id, ca_cer
|
|
48
58
|
print(qixe.ega.get_doc_list())
|
49
59
|
```
|
50
60
|
|
51
|
-
##
|
61
|
+
## Connecting to Qlik Sense Desktop
|
52
62
|
You need to start your Qlik Sense Desktop client on your local PC.
|
53
63
|
|
54
64
|
```python
|
@@ -61,5 +71,8 @@ qixe = QixEngine(url=url)
|
|
61
71
|
print(qixe.ega.get_doc_list())
|
62
72
|
```
|
63
73
|
|
74
|
+
## Examples of usage
|
75
|
+
Please click on this [link](https://github.com/lr-bicc/qe-api-client/tree/master/examples) to find examples of usage of this client.
|
76
|
+
|
64
77
|
## API reference
|
65
78
|
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
|
-
##
|
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
|
-
##
|
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[
|
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",
|
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
|
-
|
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']
|
@@ -697,5 +708,24 @@ class EngineAppApi:
|
|
697
708
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
698
709
|
try:
|
699
710
|
return response['result']
|
711
|
+
except KeyError:
|
712
|
+
return response['error']
|
713
|
+
|
714
|
+
def get_variable_by_id(self, doc_handle, variable_id):
|
715
|
+
"""
|
716
|
+
Gets the handle of a variable.
|
717
|
+
|
718
|
+
Parameters:
|
719
|
+
doc_handle (int): The handle identifying the document.
|
720
|
+
variable_id (str): The id of the variable.
|
721
|
+
|
722
|
+
Returns:
|
723
|
+
dict: The handle of the generic variable.
|
724
|
+
"""
|
725
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": doc_handle, "method": "GetVariableById",
|
726
|
+
"params": {"qId": variable_id}})
|
727
|
+
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
728
|
+
try:
|
729
|
+
return response['result']['qReturn']
|
700
730
|
except KeyError:
|
701
731
|
return response['error']
|
@@ -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
|
|
@@ -22,21 +22,12 @@ class EngineCommunicator:
|
|
22
22
|
|
23
23
|
class SecureEngineCommunicator(EngineCommunicator):
|
24
24
|
|
25
|
-
def __init__(self, url, user_directory,
|
26
|
-
user_id, ca_certs, certfile,
|
27
|
-
keyfile, app_id=None
|
28
|
-
):
|
25
|
+
def __init__(self, url, user_directory, user_id, ca_certs, certfile, keyfile, app_id=None):
|
29
26
|
self.url = "wss://" + url + ":4747/app/" + str(app_id)
|
30
|
-
certs = ({"ca_certs": ca_certs,
|
31
|
-
"
|
32
|
-
"keyfile": keyfile,
|
33
|
-
"cert_reqs": ssl.CERT_NONE,
|
34
|
-
"server_side": False
|
35
|
-
})
|
27
|
+
certs = ({"ca_certs": ca_certs, "certfile": certfile, "keyfile": keyfile, "cert_reqs": ssl.CERT_NONE,
|
28
|
+
"server_side": False})
|
36
29
|
|
37
30
|
ssl.match_hostname = lambda cert, hostname: True
|
38
31
|
header = f'X-Qlik-User: UserDirectory={user_directory}; UserId={user_id}' # NOQA
|
39
|
-
self.ws = create_connection(
|
40
|
-
self.url, sslopt=certs,
|
41
|
-
cookie=None, header={header})
|
32
|
+
self.ws = create_connection(self.url, sslopt=certs, cookie=None, header={header})
|
42
33
|
self.session = self.ws.recv()
|
@@ -66,4 +66,13 @@ 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}
|
74
|
+
|
75
|
+
def dimension_list_def():
|
76
|
+
return {"qInfo": {"qType": "DimensionList"},
|
77
|
+
"qDimensionListDef": {"qType": "dimension",
|
78
|
+
"qData": {"title": "/title", "tags": "/tags", "grouping": "/qDim/qGrouping", "info": "/qDimInfos"}}}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.2
|
2
2
|
Name: qe-api-client
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.4.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
|
@@ -12,6 +12,16 @@ Requires-Python: >=3.6
|
|
12
12
|
Description-Content-Type: text/markdown
|
13
13
|
License-File: LICENSE
|
14
14
|
Requires-Dist: websocket-client>=0.47.0
|
15
|
+
Requires-Dist: pandas>=2.2.0
|
16
|
+
Dynamic: author
|
17
|
+
Dynamic: author-email
|
18
|
+
Dynamic: classifier
|
19
|
+
Dynamic: description
|
20
|
+
Dynamic: description-content-type
|
21
|
+
Dynamic: home-page
|
22
|
+
Dynamic: requires-dist
|
23
|
+
Dynamic: requires-python
|
24
|
+
Dynamic: summary
|
15
25
|
|
16
26
|
# Qlik Engine API Client
|
17
27
|
|
@@ -28,7 +38,7 @@ Forked from [jhettler/pyqlikengine](https://github.com/jhettler/pyqlikengine)
|
|
28
38
|
pip install qe-api-client
|
29
39
|
```
|
30
40
|
|
31
|
-
##
|
41
|
+
## Connecting to Qlik Sense Enterprise Server
|
32
42
|
You need to export the Qlik Sense certificates in PEM format from the Qlik Sense Enterprise server to a local folder in
|
33
43
|
order to authenticate on the server.
|
34
44
|
|
@@ -48,7 +58,7 @@ qixe = QixEngine(url=url, user_directory=user_directory, user_id=user_id, ca_cer
|
|
48
58
|
print(qixe.ega.get_doc_list())
|
49
59
|
```
|
50
60
|
|
51
|
-
##
|
61
|
+
## Connecting to Qlik Sense Desktop
|
52
62
|
You need to start your Qlik Sense Desktop client on your local PC.
|
53
63
|
|
54
64
|
```python
|
@@ -61,5 +71,8 @@ qixe = QixEngine(url=url)
|
|
61
71
|
print(qixe.ega.get_doc_list())
|
62
72
|
```
|
63
73
|
|
74
|
+
## Examples of usage
|
75
|
+
Please click on this [link](https://github.com/lr-bicc/qe-api-client/tree/master/examples) to find examples of usage of this client.
|
76
|
+
|
64
77
|
## API reference
|
65
78
|
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
|
@@ -19,7 +18,10 @@ qe_api_client/api_classes/engine_generic_measure_api.py
|
|
19
18
|
qe_api_client/api_classes/engine_generic_object_api.py
|
20
19
|
qe_api_client/api_classes/engine_generic_variable_api.py
|
21
20
|
qe_api_client/api_classes/engine_global_api.py
|
21
|
+
test/test.py
|
22
|
+
test/test_api.py
|
22
23
|
test/test_app_api.py
|
24
|
+
test/test_chart_content.py
|
23
25
|
test/test_field_api.py
|
24
26
|
test/test_global_api.py
|
25
27
|
test/test_labs.py
|
@@ -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.
|
8
|
+
version="2.4.0",
|
9
9
|
author="Rumen Vasilev",
|
10
10
|
author_email="R.Vasilev@LRWorld.com",
|
11
11
|
description="Python wrapper around Qlik Engine JSON API",
|
@@ -20,7 +20,8 @@ setuptools.setup(
|
|
20
20
|
"Operating System :: OS Independent",
|
21
21
|
],
|
22
22
|
install_requires=[
|
23
|
-
'websocket-client>=0.47.0'
|
23
|
+
'websocket-client>=0.47.0',
|
24
|
+
'pandas>=2.2.0'
|
24
25
|
],
|
25
26
|
python_requires='>=3.6',
|
26
27
|
)
|
@@ -0,0 +1,43 @@
|
|
1
|
+
from qe_api_client.engine import QixEngine
|
2
|
+
import math
|
3
|
+
import pandas as pd
|
4
|
+
|
5
|
+
# url = 'ws://localhost:4848/app'
|
6
|
+
# qixe = QixEngine(url=url)
|
7
|
+
|
8
|
+
url = "lr-analytics-test.lr-netz.local"
|
9
|
+
user_directory = "LR"
|
10
|
+
user_id = "!QlikSense"
|
11
|
+
qlik_certs_path = "C:/LocalUserData/Certificates/Sense TEST"
|
12
|
+
ca_certs = qlik_certs_path + "/root.pem"
|
13
|
+
certfile = qlik_certs_path + "/client.pem"
|
14
|
+
keyfile = qlik_certs_path + "/client_key.pem"
|
15
|
+
qixe = QixEngine(url, user_directory, user_id, ca_certs, certfile, keyfile)
|
16
|
+
|
17
|
+
# App ID holen
|
18
|
+
doc_id = "0c6a91a3-4dc0-490e-ae0f-41391b39c2ec" # Bonus Competitions
|
19
|
+
# doc_id = "f9e79d92-652b-4ba8-8487-84e2825b71c5" # Sales KPI
|
20
|
+
# doc_id = "Test.qvf"
|
21
|
+
|
22
|
+
# App öffnen
|
23
|
+
opened_doc = qixe.ega.open_doc(doc_id)
|
24
|
+
print(opened_doc)
|
25
|
+
|
26
|
+
doc_handle = qixe.get_handle(opened_doc)
|
27
|
+
|
28
|
+
# # Lineage-Daten aus der API holen
|
29
|
+
# lineage = qixe.eaa.get_lineage(doc_handle)
|
30
|
+
# print(lineage)
|
31
|
+
#
|
32
|
+
# # Erstelle den DataFrame und fülle fehlende Werte mit ""
|
33
|
+
# df = pd.DataFrame(lineage) #.fillna("")
|
34
|
+
# df = df[(df["qDiscriminator"].notna()) | (df["qStatement"].notna())].fillna("")
|
35
|
+
# # df = df.reindex(columns=["qDiscriminator", "qStatement"]).fillna("")
|
36
|
+
|
37
|
+
df = qixe.get_app_lineage_info(doc_handle)
|
38
|
+
|
39
|
+
print(df)
|
40
|
+
|
41
|
+
|
42
|
+
# Websocket-Verbindung schließen
|
43
|
+
QixEngine.disconnect(qixe)
|
@@ -0,0 +1,52 @@
|
|
1
|
+
from qe_api_client.engine import QixEngine
|
2
|
+
from qe_api_client.structs import field_value
|
3
|
+
|
4
|
+
# url = 'lr-analytics-test.lr-netz.local'
|
5
|
+
# user_directory = 'LR'
|
6
|
+
# user_id = 'r.vasilev'
|
7
|
+
# ca_certs = 'C:\\LocalUserData\\Certificates\\Sense TEST\\root.pem'
|
8
|
+
# certfile = 'C:\\LocalUserData\\Certificates\\Sense TEST\\client.pem'
|
9
|
+
# keyfile = 'C:\\LocalUserData\\Certificates\\Sense TEST\\client_key.pem'
|
10
|
+
# qixe = QixEngine(url=url, user_directory=user_directory, user_id=user_id, ca_certs=ca_certs, certfile=certfile,
|
11
|
+
# keyfile=keyfile)
|
12
|
+
|
13
|
+
url = 'ws://localhost:4848/app'
|
14
|
+
qixe = QixEngine(url)
|
15
|
+
opened_app = qixe.ega.open_doc("Test")
|
16
|
+
# print(opened_app)
|
17
|
+
app_handle = qixe.get_handle(opened_app)
|
18
|
+
# print(app_handle)
|
19
|
+
|
20
|
+
list_of_values = ["A", "C"]
|
21
|
+
|
22
|
+
test = qixe.select_in_dimension(app_handle, "Dim1", ["A", "B"])
|
23
|
+
print(test)
|
24
|
+
|
25
|
+
# field = qixe.eaa.get_field(app_handle, "Dim1")
|
26
|
+
# print(field)
|
27
|
+
#
|
28
|
+
# fld_handle = qixe.get_handle(field)
|
29
|
+
# print(fld_handle)
|
30
|
+
|
31
|
+
# selected_value = qixe.efa.select(field_handle, "B")
|
32
|
+
# print(selected_value)
|
33
|
+
|
34
|
+
# fld_value_1 = qixe.structs.field_value("A")
|
35
|
+
# fld_value_2 = qixe.structs.field_value("C")
|
36
|
+
# selected_values = qixe.efa.select_values(fld_handle, [fld_value_1, fld_value_2])
|
37
|
+
|
38
|
+
# values_to_select = []
|
39
|
+
# for val in list_of_values:
|
40
|
+
# fld_value = qixe.structs.field_value(val)
|
41
|
+
# values_to_select.append(fld_value)
|
42
|
+
# response = qixe.efa.select_values(fld_handle, values_to_select)
|
43
|
+
# print(response)
|
44
|
+
|
45
|
+
df = qixe.get_constructed_table_data(app_handle, [], [],
|
46
|
+
["BjKvssq", "48a5672b-e9b3-4f96-8ff4-480f606e3c14"],
|
47
|
+
["snmpR", "1ad7060c-56ec-46d1-b83a-ff1393e0b236"])
|
48
|
+
|
49
|
+
print(df)
|
50
|
+
|
51
|
+
# Websocket-Verbindung schließen
|
52
|
+
QixEngine.disconnect(qixe)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
from qe_api_client.engine import QixEngine
|
2
|
+
|
3
|
+
url = 'ws://localhost:4848/app'
|
4
|
+
qixe = QixEngine(url=url)
|
5
|
+
|
6
|
+
# App ID holen
|
7
|
+
# doc_id = "f9e79d92-652b-4ba8-8487-84e2825b71c5" # Sales KPI
|
8
|
+
doc_id = "Test.qvf"
|
9
|
+
|
10
|
+
# App öffnen
|
11
|
+
opened_doc = qixe.ega.open_doc(doc_id)
|
12
|
+
# print(opened_doc)
|
13
|
+
|
14
|
+
doc_handle = qixe.get_handle(opened_doc)
|
15
|
+
|
16
|
+
df = qixe.get_chart_data(doc_handle, "tshujdG") # Pivot: wPSYmr | Straight: tshujdG | Bar chart: LapHp | Pie chart: gYyUxS
|
17
|
+
print(df)
|
@@ -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
|
File without changes
|
File without changes
|
File without changes
|
{qe_api_client-2.2.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/engine_generic_measure_api.py
RENAMED
File without changes
|
{qe_api_client-2.2.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/engine_generic_object_api.py
RENAMED
File without changes
|
{qe_api_client-2.2.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/engine_generic_variable_api.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|