qe-api-client 1.1.0__py3-none-any.whl → 2.0.0__py3-none-any.whl
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/api_classes/__init__.py +0 -0
- qe_api_client/{engine_app_api.py → api_classes/engine_app_api.py} +247 -327
- qe_api_client/api_classes/engine_field_api.py +127 -0
- qe_api_client/api_classes/engine_generic_dimension_api.py +38 -0
- qe_api_client/api_classes/engine_generic_measure_api.py +37 -0
- qe_api_client/api_classes/engine_generic_object_api.py +163 -0
- qe_api_client/api_classes/engine_generic_variable_api.py +56 -0
- qe_api_client/{engine_global_api.py → api_classes/engine_global_api.py} +291 -145
- qe_api_client/engine.py +193 -40
- qe_api_client/engine_helper.py +8 -8
- qe_api_client/structs.py +72 -98
- {qe_api_client-1.1.0.dist-info → qe_api_client-2.0.0.dist-info}/METADATA +26 -6
- qe_api_client-2.0.0.dist-info/RECORD +18 -0
- {qe_api_client-1.1.0.dist-info → qe_api_client-2.0.0.dist-info}/WHEEL +1 -1
- qe_api_client/engine_field_api.py +0 -81
- qe_api_client/engine_generic_object_api.py +0 -101
- qe_api_client/engine_generic_variable_api.py +0 -24
- qe_api_client-1.1.0.dist-info/RECORD +0 -15
- {qe_api_client-1.1.0.dist-info → qe_api_client-2.0.0.dist-info}/LICENSE +0 -0
- {qe_api_client-1.1.0.dist-info → qe_api_client-2.0.0.dist-info}/top_level.txt +0 -0
@@ -2,25 +2,46 @@ import json
|
|
2
2
|
|
3
3
|
|
4
4
|
class EngineGlobalApi:
|
5
|
+
"""
|
6
|
+
A class to interact with the Qlik Engine Global API using a provided socket interface.
|
7
|
+
|
8
|
+
Attributes:
|
9
|
+
engine_socket : object
|
10
|
+
The socket object used to communicate with the Qlik Engine.
|
11
|
+
"""
|
12
|
+
|
5
13
|
def __init__(self, socket):
|
14
|
+
"""
|
15
|
+
Initializes the EngineGlobalApi with a socket object.
|
16
|
+
|
17
|
+
Parameters:
|
18
|
+
socket : object
|
19
|
+
The socket object used to communicate with the Qlik Engine.
|
20
|
+
"""
|
6
21
|
self.engine_socket = socket
|
7
22
|
|
8
|
-
# returns an array of doc objects.
|
9
|
-
# The doc object contains doc name, size, file time etc
|
10
23
|
def get_doc_list(self):
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
24
|
+
"""
|
25
|
+
Retrieves a list of documents available in the Qlik Sense environment.
|
26
|
+
|
27
|
+
Returns:
|
28
|
+
list of dict: An array of document objects containing details such as doc name, size, and file time.
|
29
|
+
"""
|
30
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "GetDocList", "params": []})
|
31
|
+
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
15
32
|
try:
|
16
33
|
return response['result']['qDocList']
|
17
34
|
except KeyError:
|
18
35
|
return response['error']
|
19
36
|
|
20
|
-
# returns the os name (always windowsNT). Obsolete?
|
21
37
|
def get_os_name(self):
|
22
|
-
|
23
|
-
|
38
|
+
"""
|
39
|
+
Retrieves the operating system name where the Qlik Sense Engine is running.
|
40
|
+
|
41
|
+
Returns:
|
42
|
+
str: The OS name, typically "windowsNT".
|
43
|
+
"""
|
44
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "OSName", "params": []})
|
24
45
|
response = json.loads(
|
25
46
|
self.engine_socket.send_call(self.engine_socket, msg))
|
26
47
|
try:
|
@@ -28,14 +49,19 @@ class EngineGlobalApi:
|
|
28
49
|
except KeyError:
|
29
50
|
return response['error']
|
30
51
|
|
31
|
-
# returns the app id. If desktop is used the app id is the same
|
32
|
-
# as the full path to qvf if it's running against Enterprise,
|
33
|
-
# app id will be a guid
|
34
52
|
def create_app(self, app_name):
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
53
|
+
"""
|
54
|
+
Creates a new application in Qlik Sense.
|
55
|
+
|
56
|
+
Parameters:
|
57
|
+
app_name : str
|
58
|
+
The name of the application to be created.
|
59
|
+
|
60
|
+
Returns:
|
61
|
+
dict: Information about the created app, including its ID.
|
62
|
+
"""
|
63
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "CreateApp", "params": [app_name]})
|
64
|
+
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
39
65
|
try:
|
40
66
|
return response['result']
|
41
67
|
except KeyError:
|
@@ -48,10 +74,18 @@ class EngineGlobalApi:
|
|
48
74
|
# of the app to delete. In Qlik Sense Enterprise, the identifier of the app is a GUID in the Qlik Sense # NOQA
|
49
75
|
# repository. In Qlik Sense Desktop, the identifier of the app is the name of the app, as defined in the apps # NOQA
|
50
76
|
# folder %userprofile%\Documents\Qlik\Sense\Apps. This parameter is mandatory. # NOQA
|
51
|
-
|
52
77
|
def delete_app(self, app_name):
|
53
|
-
|
54
|
-
|
78
|
+
"""
|
79
|
+
Deletes an application from the Qlik Sense repository or file system.
|
80
|
+
|
81
|
+
Parameters:
|
82
|
+
app_name : str
|
83
|
+
The name or identifier of the app to delete.
|
84
|
+
|
85
|
+
Returns:
|
86
|
+
dict: Information about the deletion result.
|
87
|
+
"""
|
88
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "DeleteApp", "params": [app_name]})
|
55
89
|
response = json.loads(
|
56
90
|
self.engine_socket.send_call(self.engine_socket, msg))
|
57
91
|
try:
|
@@ -59,46 +93,58 @@ class EngineGlobalApi:
|
|
59
93
|
except KeyError:
|
60
94
|
return response["error"]
|
61
95
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
96
|
+
def open_doc(self, app_name, user_name='', password='', serial='', no_data=False):
|
97
|
+
"""
|
98
|
+
Opens a document (app) in Qlik Sense and returns details about it.
|
99
|
+
|
100
|
+
Parameters:
|
101
|
+
app_name : str
|
102
|
+
The name of the app to open.
|
103
|
+
user_name : str, optional
|
104
|
+
The username for authentication (default is '').
|
105
|
+
password : str, optional
|
106
|
+
The password for authentication (default is '').
|
107
|
+
serial : str, optional
|
108
|
+
The serial key for authentication (default is '').
|
109
|
+
no_data : bool, optional
|
110
|
+
If True, opens the app without data (default is False).
|
111
|
+
|
112
|
+
Returns:
|
113
|
+
dict: Information about the opened document, including handle, generic ID, and type.
|
114
|
+
"""
|
115
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "OpenDoc",
|
116
|
+
"params": [app_name, user_name, password, serial, no_data]})
|
117
|
+
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
73
118
|
try:
|
74
|
-
return response[
|
119
|
+
return response["result"]["qReturn"]
|
75
120
|
except KeyError:
|
76
121
|
return response["error"]
|
77
122
|
|
78
123
|
# returns an object with handle, generic id and type for the active app
|
79
124
|
def get_active_doc(self):
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
125
|
+
"""
|
126
|
+
Retrieves the currently active document in Qlik Sense.
|
127
|
+
|
128
|
+
Returns:
|
129
|
+
dict: Information about the active document.
|
130
|
+
"""
|
131
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "GetActiveDoc", "params": []})
|
132
|
+
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
84
133
|
try:
|
85
134
|
return response['result']
|
86
135
|
except KeyError:
|
87
136
|
return response["error"]
|
88
137
|
|
89
|
-
@staticmethod
|
90
|
-
def get_handle(obj):
|
91
|
-
try:
|
92
|
-
return obj["qHandle"]
|
93
|
-
except ValueError:
|
94
|
-
return "Bad handle value in " + obj
|
95
|
-
|
96
138
|
# Abort All commands
|
97
139
|
def abort_all(self):
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
140
|
+
"""
|
141
|
+
Aborts all ongoing commands in Qlik Sense.
|
142
|
+
|
143
|
+
Returns:
|
144
|
+
dict: Information about the abort result.
|
145
|
+
"""
|
146
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "AbortAll", "params": []})
|
147
|
+
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
102
148
|
try:
|
103
149
|
return response['result']
|
104
150
|
except KeyError:
|
@@ -106,9 +152,18 @@ class EngineGlobalApi:
|
|
106
152
|
|
107
153
|
# Abort Specific Request
|
108
154
|
def abort_request(self, request_id):
|
155
|
+
"""
|
156
|
+
Aborts a specific request in Qlik Sense.
|
157
|
+
|
158
|
+
Parameters:
|
159
|
+
request_id : str
|
160
|
+
The identifier of the request to abort.
|
161
|
+
|
162
|
+
Returns:
|
163
|
+
dict: Information about the abort result.
|
164
|
+
"""
|
109
165
|
msg = json.dumps(
|
110
|
-
{"jsonrpc": "2.0", "id": 0, "handle": -1,
|
111
|
-
"method": "AbortRequest", "params": {"qRequestId": request_id}})
|
166
|
+
{"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "AbortRequest", "params": {"qRequestId": request_id}})
|
112
167
|
response = json.loads(
|
113
168
|
self.engine_socket.send_call(self.engine_socket, msg))
|
114
169
|
try:
|
@@ -124,15 +179,25 @@ class EngineGlobalApi:
|
|
124
179
|
# interaction is 1 (qDef.qResult is 1), the engine continues the script execution otherwise the execution is # NOQA
|
125
180
|
# halted. This parameter is relevant only if the variable ErrorMode is set to 1 and the script is run in debug # NOQA
|
126
181
|
# mode (qDebug is set to true when calling the DoReload method).
|
127
|
-
def configure_reload(self, cancel_on_error=False,
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
182
|
+
def configure_reload(self, cancel_on_error=False, use_error_data=True, interact_on_error=False):
|
183
|
+
"""
|
184
|
+
Configures the reload settings for a Qlik Sense application.
|
185
|
+
|
186
|
+
Parameters:
|
187
|
+
cancel_on_error : bool, optional
|
188
|
+
If True, the script execution is halted on error (default is False).
|
189
|
+
use_error_data : bool, optional
|
190
|
+
If True, any script execution error is returned in qErrorData (default is True).
|
191
|
+
interact_on_error : bool, optional
|
192
|
+
If True, script execution is halted on error and awaits interaction (default is False).
|
193
|
+
|
194
|
+
Returns:
|
195
|
+
dict: Information about the configuration result.
|
196
|
+
"""
|
197
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "ConfigureReload",
|
198
|
+
"params": {"qCancelOnScriptError": cancel_on_error, "qUseErrorData": use_error_data,
|
133
199
|
"qInteractOnError": interact_on_error}})
|
134
|
-
response = json.loads(
|
135
|
-
self.engine_socket.send_call(self.engine_socket, msg))
|
200
|
+
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
136
201
|
try:
|
137
202
|
return response['result']
|
138
203
|
except KeyError:
|
@@ -152,11 +217,22 @@ class EngineGlobalApi:
|
|
152
217
|
|
153
218
|
# BUG - Does not work in September 2017 release
|
154
219
|
def copy_app(self, target_app_id, src_app_id, qIds=[""]):
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
220
|
+
"""
|
221
|
+
Copies an app in Qlik Sense from a source app ID to a target app ID.
|
222
|
+
|
223
|
+
Parameters:
|
224
|
+
target_app_id : str
|
225
|
+
The identifier (GUID) of the target app.
|
226
|
+
src_app_id : str
|
227
|
+
The identifier (GUID) of the source app.
|
228
|
+
qIds : list, optional
|
229
|
+
List of object identifiers to copy. If empty, all objects are copied (default is [""]).
|
230
|
+
|
231
|
+
Returns:
|
232
|
+
dict: Information about the copy result.
|
233
|
+
"""
|
234
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "CopyApp",
|
235
|
+
"params": {"qTargetAppId": target_app_id, "qSrcAppId": src_app_id, "qIds": qIds}})
|
160
236
|
response = json.loads(
|
161
237
|
self.engine_socket.send_call(self.engine_socket, msg))
|
162
238
|
try:
|
@@ -168,10 +244,14 @@ class EngineGlobalApi:
|
|
168
244
|
# automatically assigns a unique identifier to the session app. A session app is not persisted and cannot be # NOQA
|
169
245
|
# saved. Everything created during a session app is non-persisted; for example: objects, data connections. # NOQA
|
170
246
|
def create_session_app(self):
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
247
|
+
"""
|
248
|
+
Creates an empty session app in Qlik Sense.
|
249
|
+
|
250
|
+
Returns:
|
251
|
+
dict: Information about the created session app.
|
252
|
+
"""
|
253
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "CreateSessionApp", "params": {}})
|
254
|
+
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
175
255
|
try:
|
176
256
|
return response['result']
|
177
257
|
except KeyError:
|
@@ -187,11 +267,19 @@ class EngineGlobalApi:
|
|
187
267
|
# persisted and cannot be saved. Everything created during a session app is non-persisted; for example: objects, # NOQA
|
188
268
|
# data connections.
|
189
269
|
def create_session_app_from_app(self, src_app_id):
|
190
|
-
|
191
|
-
|
270
|
+
"""
|
271
|
+
Creates a session app in Qlik Sense from an existing app.
|
272
|
+
|
273
|
+
Parameters:
|
274
|
+
src_app_id : str
|
275
|
+
The identifier (GUID) of the source app.
|
276
|
+
|
277
|
+
Returns:
|
278
|
+
dict: Information about the created session app.
|
279
|
+
"""
|
280
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "CreateSessionAppFromApp",
|
192
281
|
"params": {"qSrcAppId": src_app_id}})
|
193
|
-
response = json.loads(
|
194
|
-
self.engine_socket.send_call(self.engine_socket, msg))
|
282
|
+
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
195
283
|
try:
|
196
284
|
return response['result']
|
197
285
|
except KeyError:
|
@@ -203,14 +291,23 @@ class EngineGlobalApi:
|
|
203
291
|
# repository. qIds - Array of identifiers.. The list of all the objects in the app to be exported must be given. # NOQA
|
204
292
|
# This list must contain the GUIDs of all these objects.
|
205
293
|
def export_app(self, target_path, src_app_id, qIds=[""]):
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
294
|
+
"""
|
295
|
+
Exports an app from the Qlik Sense repository to the file system.
|
296
|
+
|
297
|
+
This operation is available only in Qlik Sense Enterprise.
|
298
|
+
|
299
|
+
Parameters:
|
300
|
+
target_path (str): The path and name of the target app file to export to.
|
301
|
+
src_app_id (str): The GUID of the source app in the Qlik Sense repository.
|
302
|
+
qIds (list of str): An array of identifiers (GUIDs) for the objects in the app to be exported.
|
303
|
+
The list must contain the GUIDs of all these objects.
|
304
|
+
|
305
|
+
Returns:
|
306
|
+
dict: The result of the export operation. In case of an error, returns the error information.
|
307
|
+
"""
|
308
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "ExportApp",
|
309
|
+
"params": {"qTargetPath": target_path, "qSrcAppId": src_app_id, "qIds": qIds}})
|
310
|
+
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
214
311
|
try:
|
215
312
|
return response['result']
|
216
313
|
except KeyError:
|
@@ -227,14 +324,27 @@ class EngineGlobalApi:
|
|
227
324
|
# contains objects that are not present in the source app, the objects related to these identifiers are removed # NOQA
|
228
325
|
# from the target app.
|
229
326
|
def replace_app_from_id(self, target_path, src_app_id, qIds=[""]):
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
327
|
+
"""
|
328
|
+
Replaces an app with the objects from a source app.
|
329
|
+
|
330
|
+
The list of objects in the app to be replaced must be defined in qIds.
|
331
|
+
This operation is available only in Qlik Sense Enterprise.
|
332
|
+
|
333
|
+
Parameters:
|
334
|
+
target_app_id (str): The GUID of the target app to be replaced.
|
335
|
+
src_app_id (str): The GUID of the source app in the Qlik Sense repository.
|
336
|
+
qIds (list of str): An array of GUIDs for the objects in the target app to be replaced.
|
337
|
+
Only QRS-approved GUIDs are applicable. If qIds is empty,
|
338
|
+
the engine automatically creates a list containing all QRS-approved objects.
|
339
|
+
If the array contains objects not present in the source app,
|
340
|
+
those objects are removed from the target app.
|
341
|
+
|
342
|
+
Returns:
|
343
|
+
dict: The result of the replace operation. In case of an error, returns the error information.
|
344
|
+
"""
|
345
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "ReplaceAppFromID",
|
346
|
+
"params": {"qTargetAppId": target_path, "qSrcAppId": src_app_id, "qIds": qIds}})
|
347
|
+
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
238
348
|
try:
|
239
349
|
return response['result']
|
240
350
|
except KeyError:
|
@@ -243,10 +353,15 @@ class EngineGlobalApi:
|
|
243
353
|
# GetAuthenticatedUser
|
244
354
|
# No parameters
|
245
355
|
def get_auth_user(self):
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
356
|
+
"""
|
357
|
+
Retrieves information about the authenticated user.
|
358
|
+
|
359
|
+
Returns:
|
360
|
+
dict: The result containing information about the authenticated user.
|
361
|
+
In case of an error, returns the error information.
|
362
|
+
"""
|
363
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "GetAuthenticatedUser", "params": {}})
|
364
|
+
response_json = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
250
365
|
try:
|
251
366
|
return response_json["result"]
|
252
367
|
except KeyError:
|
@@ -267,50 +382,60 @@ class EngineGlobalApi:
|
|
267
382
|
# qModifiedDate: Is generated by the engine. Creation date of the connection or last modification date of th # NOQA
|
268
383
|
# connection. qMeta: Information about the connection. qLogOn (SSO Passthrough or not): Select which user # NOQA
|
269
384
|
# credentials to use to connect to the source. LOG_ON_SERVICE_USER: Disables, LOG_ON_CURRENT_USER: Enabl # NOQA
|
270
|
-
def list_databases_from_odbc(self, connect_name,
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
385
|
+
def list_databases_from_odbc(self, connect_name, connect_string, connect_type, user_name, password, mod_date="",
|
386
|
+
meta="", sso_passthrough="LOG_ON_SERVICE_USER"):
|
387
|
+
"""
|
388
|
+
Lists the databases available in an ODBC, OLEDB, or CUSTOM data source.
|
389
|
+
|
390
|
+
Parameters:
|
391
|
+
connect_name (str): Name of the connection.
|
392
|
+
connect_string (str): Connection string (e.g., ODBC CONNECT TO [<provider name>]).
|
393
|
+
connect_type (str): Type of the connection (ODBC, OLEDB, CUSTOM, etc.).
|
394
|
+
user_name (str): Name of the user creating the connection.
|
395
|
+
password (str): Password of the user creating the connection.
|
396
|
+
mod_date (str, optional): Modification date of the connection.
|
397
|
+
meta (str, optional): Metadata information about the connection.
|
398
|
+
sso_passthrough (str, optional): User credentials to use (LOG_ON_SERVICE_USER, LOG_ON_CURRENT_USER).
|
399
|
+
|
400
|
+
Returns:
|
401
|
+
dict: A dictionary containing the list of databases.
|
402
|
+
In case of an error, returns the error information.
|
403
|
+
"""
|
404
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "GetDatabasesFromConnectionString",
|
405
|
+
"params": [{"qId": "", "qName": connect_name, "qConnectionString": connect_string,
|
406
|
+
"qType": connect_type, "qUserName": user_name, "qPassword": password,
|
407
|
+
"qModifiedDate": mod_date, "qMeta": meta, "qLogOn": sso_passthrough}]})
|
408
|
+
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
288
409
|
try:
|
289
410
|
return response['result']
|
290
411
|
except KeyError:
|
291
412
|
return response['error']
|
292
413
|
|
293
414
|
# IsValidConnectionString method: Checks if a connection string is valid.
|
294
|
-
def is_valid_connect_string(self, connect_name,
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
415
|
+
def is_valid_connect_string(self, connect_name, connect_string, connect_type, user_name, password, mod_date="",
|
416
|
+
meta="", sso_passthrough="LOG_ON_SERVICE_USER"):
|
417
|
+
"""
|
418
|
+
Checks if a connection string is valid.
|
419
|
+
|
420
|
+
Parameters:
|
421
|
+
connect_name (str): Name of the connection.
|
422
|
+
connect_string (str): Connection string (e.g., ODBC CONNECT TO [<provider name>]).
|
423
|
+
connect_type (str): Type of the connection (ODBC, OLEDB, CUSTOM, etc.).
|
424
|
+
user_name (str): Name of the user creating the connection.
|
425
|
+
password (str): Password of the user creating the connection.
|
426
|
+
mod_date (str, optional): Modification date of the connection.
|
427
|
+
meta (str, optional): Metadata information about the connection.
|
428
|
+
sso_passthrough (str, optional): User credentials to use (LOG_ON_SERVICE_USER, LOG_ON_CURRENT_USER).
|
429
|
+
|
430
|
+
Returns:
|
431
|
+
dict: A dictionary containing validation information.
|
432
|
+
In case of an error, returns the error information.
|
433
|
+
"""
|
434
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "IsValidConnectionString",
|
435
|
+
"params": [{"qId": "", "qName": connect_name, "qConnectionString": connect_string,
|
436
|
+
"qType": connect_type, "qUserName": user_name, "qPassword": password,
|
437
|
+
"qModifiedDate": mod_date, "qMeta": meta, "qLogOn": sso_passthrough}]})
|
438
|
+
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
314
439
|
try:
|
315
440
|
return response['result'] # Returns an array of databases
|
316
441
|
except KeyError:
|
@@ -318,10 +443,15 @@ class EngineGlobalApi:
|
|
318
443
|
|
319
444
|
# GetOdbcDsns: List all the ODBC connectors installed on the Sense server machine in Windows # NOQA
|
320
445
|
def get_odbc_dsns(self):
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
446
|
+
"""
|
447
|
+
Retrieves a list of all ODBC connectors installed on the Qlik Sense server.
|
448
|
+
|
449
|
+
Returns:
|
450
|
+
dict: A dictionary containing the details of the ODBC connectors installed.
|
451
|
+
In case of an error, returns the error information.
|
452
|
+
"""
|
453
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "GetOdbcDsns", "params": {}})
|
454
|
+
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
325
455
|
try:
|
326
456
|
return response['result']
|
327
457
|
except KeyError:
|
@@ -329,8 +459,14 @@ class EngineGlobalApi:
|
|
329
459
|
|
330
460
|
# GetOleDbProviders: Returns the list of the OLEDB providers installed on the system. # NOQA
|
331
461
|
def get_ole_dbs(self):
|
332
|
-
|
333
|
-
|
462
|
+
"""
|
463
|
+
Retrieves a list of all OLEDB providers installed on the Qlik Sense server.
|
464
|
+
|
465
|
+
Returns:
|
466
|
+
dict: A dictionary containing the details of the OLEDB providers installed.
|
467
|
+
In case of an error, returns the error information.
|
468
|
+
"""
|
469
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "GetOleDbProviders", "params": {}})
|
334
470
|
response = json.loads(
|
335
471
|
self.engine_socket.send_call(self.engine_socket, msg))
|
336
472
|
try:
|
@@ -344,10 +480,19 @@ class EngineGlobalApi:
|
|
344
480
|
# returned but information like when the request started and finished is not returned. # NOQA
|
345
481
|
|
346
482
|
def get_progress(self, request_id):
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
483
|
+
"""
|
484
|
+
Provides information about the progress of DoReload and DoSave calls.
|
485
|
+
|
486
|
+
Parameters:
|
487
|
+
request_id (int): Identifier of the DoReload or DoSave request.
|
488
|
+
If set to 0, only limited information is provided.
|
489
|
+
|
490
|
+
Returns:
|
491
|
+
dict: A dictionary containing progress messages and error messages.
|
492
|
+
If request_id is 0, detailed information like start and end times is not provided.
|
493
|
+
"""
|
494
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "GetProgress", "params": {}})
|
495
|
+
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
351
496
|
try:
|
352
497
|
return response['result']
|
353
498
|
except KeyError:
|
@@ -357,19 +502,20 @@ class EngineGlobalApi:
|
|
357
502
|
# in Qlik Sense Desktop.
|
358
503
|
# No parameters
|
359
504
|
def is_desktop_mode(self, request_id):
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
505
|
+
"""
|
506
|
+
Checks if the user is working in Qlik Sense Desktop mode.
|
507
|
+
|
508
|
+
Returns:
|
509
|
+
dict: A dictionary indicating whether the user is in desktop mode.
|
510
|
+
In case of an error, returns the error information.
|
511
|
+
"""
|
512
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "IsDesktopMode", "params": {}})
|
513
|
+
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
364
514
|
try:
|
365
515
|
return response['result']
|
366
516
|
except KeyError:
|
367
517
|
return response['error']
|
368
518
|
|
369
|
-
@staticmethod
|
370
|
-
def get_doc_handle(doc_object):
|
371
|
-
return doc_object['qHandle']
|
372
|
-
|
373
519
|
# ## NOT IMPLEMENTED, perceived out of use case scope: ## CreateDocEx, GetBaseBNFHash, GetBaseBNF, GetBNF, # NOQA
|
374
520
|
# GetCustomConnectors, GetDefaultAppFolder, GetFunctions, GetInteract, GetLogicalDriveStrings, # NOQA
|
375
521
|
# ## GetStreamList, GetSupportedCodePages, GetUniqueID, InteractDone, IsPersonalMode (deprecated), OSVersion, # NOQA
|