pyexasol 2.3.1__tar.gz → 2.3.2__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.
- {pyexasol-2.3.1 → pyexasol-2.3.2}/PKG-INFO +1 -1
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol/connection.py +48 -10
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol/http_transport.py +29 -5
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyproject.toml +1 -1
- {pyexasol-2.3.1 → pyexasol-2.3.2}/LICENSE.txt +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/README.md +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/exasol/driver/__init__.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/exasol/driver/websocket/__init__.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/exasol/driver/websocket/_connection.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/exasol/driver/websocket/_cursor.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/exasol/driver/websocket/_errors.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/exasol/driver/websocket/_protocols.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/exasol/driver/websocket/_types.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/exasol/driver/websocket/dbapi2.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol/__init__.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol/__main__.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol/_metadata.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol/_sql_splitter.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol/callback.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol/constant.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol/db2/__init__.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol/exceptions.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol/ext.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol/formatter.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol/local_config.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol/logger.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol/mapper.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol/meta.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol/py.typed +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol/script_output.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol/statement.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol/warnings.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol_utils/__init__.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol_utils/bench.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol_utils/bench_sql/prepare.sql +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol_utils/bench_sql/t1_group_by.sql +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol_utils/bench_sql/t2_local_join.sql +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol_utils/bench_sql/t3_global_join.sql +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol_utils/bench_sql/t4_sort.sql +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol_utils/docker_util.py +0 -0
- {pyexasol-2.3.1 → pyexasol-2.3.2}/pyexasol_utils/script_output.py +0 -0
|
@@ -906,14 +906,22 @@ class ExaConnection:
|
|
|
906
906
|
False if ("format" in export_params) else self.options["compression"]
|
|
907
907
|
)
|
|
908
908
|
|
|
909
|
+
# Set when either worker finishes, successfully or exceptionally. It
|
|
910
|
+
# wakes the coordinator but does not terminate the other worker.
|
|
911
|
+
worker_finished_event = threading.Event()
|
|
909
912
|
http_thread = ExaHttpThread(
|
|
910
|
-
self.ws_ipaddr, # type: ignore
|
|
911
|
-
self.ws_port, # type: ignore
|
|
912
|
-
compression,
|
|
913
|
-
self.options["encryption"],
|
|
913
|
+
ipaddr=self.ws_ipaddr, # type: ignore
|
|
914
|
+
port=self.ws_port, # type: ignore
|
|
915
|
+
compression=compression,
|
|
916
|
+
encryption=self.options["encryption"],
|
|
917
|
+
worker_finished_event=worker_finished_event,
|
|
914
918
|
)
|
|
915
919
|
sql_thread = ExaSQLExportThread(
|
|
916
|
-
self,
|
|
920
|
+
connection=self,
|
|
921
|
+
compression=compression,
|
|
922
|
+
query_or_table=query_or_table,
|
|
923
|
+
export_params=export_params,
|
|
924
|
+
worker_finished_event=worker_finished_event,
|
|
917
925
|
)
|
|
918
926
|
|
|
919
927
|
try:
|
|
@@ -925,6 +933,14 @@ class ExaConnection:
|
|
|
925
933
|
with http_thread.read_pipe as pipe:
|
|
926
934
|
result = callback(pipe, dst, **callback_params)
|
|
927
935
|
|
|
936
|
+
# Either worker may finish first. Wake up as soon as one reports
|
|
937
|
+
# completion so errors can be observed without waiting on the
|
|
938
|
+
# other connection indefinitely.
|
|
939
|
+
worker_finished_event.wait()
|
|
940
|
+
|
|
941
|
+
# Join HTTP first: an SQL failure terminates HTTP, while HTTP does
|
|
942
|
+
# not terminate SQL directly. The order prevents waiting on HTTP
|
|
943
|
+
# before the SQL worker has had a chance to stop it.
|
|
928
944
|
http_thread.join_with_exc()
|
|
929
945
|
sql_thread.join_with_exc()
|
|
930
946
|
|
|
@@ -987,13 +1003,23 @@ class ExaConnection:
|
|
|
987
1003
|
False if ("format" in import_params) else self.options["compression"]
|
|
988
1004
|
)
|
|
989
1005
|
|
|
1006
|
+
# Set when either worker finishes, successfully or exceptionally. It
|
|
1007
|
+
# wakes the coordinator but does not terminate the other worker.
|
|
1008
|
+
worker_finished_event = threading.Event()
|
|
990
1009
|
http_thread = ExaHttpThread(
|
|
991
|
-
self.ws_ipaddr, # type: ignore
|
|
992
|
-
self.ws_port, # type: ignore
|
|
993
|
-
compression,
|
|
994
|
-
self.options["encryption"],
|
|
1010
|
+
ipaddr=self.ws_ipaddr, # type: ignore
|
|
1011
|
+
port=self.ws_port, # type: ignore
|
|
1012
|
+
compression=compression,
|
|
1013
|
+
encryption=self.options["encryption"],
|
|
1014
|
+
worker_finished_event=worker_finished_event,
|
|
1015
|
+
)
|
|
1016
|
+
sql_thread = ExaSQLImportThread(
|
|
1017
|
+
connection=self,
|
|
1018
|
+
compression=compression,
|
|
1019
|
+
table=table,
|
|
1020
|
+
import_params=import_params,
|
|
1021
|
+
worker_finished_event=worker_finished_event,
|
|
995
1022
|
)
|
|
996
|
-
sql_thread = ExaSQLImportThread(self, compression, table, import_params)
|
|
997
1023
|
|
|
998
1024
|
try:
|
|
999
1025
|
http_thread.start()
|
|
@@ -1004,6 +1030,18 @@ class ExaConnection:
|
|
|
1004
1030
|
with http_thread.write_pipe as pipe:
|
|
1005
1031
|
result = callback(pipe, src, **callback_params)
|
|
1006
1032
|
|
|
1033
|
+
# The callback has finished writing. Allow the HTTP handler to send the
|
|
1034
|
+
# final chunk and finish the request.
|
|
1035
|
+
http_thread.server.can_finish_get.set()
|
|
1036
|
+
|
|
1037
|
+
# Either worker may finish first. Wake up as soon as one reports
|
|
1038
|
+
# completion so errors can be observed without waiting on the
|
|
1039
|
+
# other connection indefinitely.
|
|
1040
|
+
worker_finished_event.wait()
|
|
1041
|
+
|
|
1042
|
+
# Join HTTP first: an SQL failure terminates HTTP, while HTTP does
|
|
1043
|
+
# not terminate SQL directly. The order prevents waiting on HTTP
|
|
1044
|
+
# before the SQL worker has had a chance to stop it.
|
|
1007
1045
|
http_thread.join_with_exc()
|
|
1008
1046
|
sql_thread.join_with_exc()
|
|
1009
1047
|
|
|
@@ -298,7 +298,12 @@ class ExaSQLThread(threading.Thread):
|
|
|
298
298
|
Thread class which re-throws any Exception to parent thread
|
|
299
299
|
"""
|
|
300
300
|
|
|
301
|
-
def __init__(
|
|
301
|
+
def __init__(
|
|
302
|
+
self,
|
|
303
|
+
connection: ExaConnection,
|
|
304
|
+
compression: bool,
|
|
305
|
+
worker_finished_event: threading.Event | None = None,
|
|
306
|
+
):
|
|
302
307
|
self.connection = connection
|
|
303
308
|
self.compression = compression
|
|
304
309
|
|
|
@@ -306,6 +311,7 @@ class ExaSQLThread(threading.Thread):
|
|
|
306
311
|
self.http_thread = None
|
|
307
312
|
self.exa_address_list: list[str] = []
|
|
308
313
|
self.exc = None
|
|
314
|
+
self.worker_finished_event = worker_finished_event
|
|
309
315
|
|
|
310
316
|
super().__init__()
|
|
311
317
|
|
|
@@ -325,13 +331,15 @@ class ExaSQLThread(threading.Thread):
|
|
|
325
331
|
# In case of SQL error stop HTTP server, close pipes and interrupt I/O in callback function
|
|
326
332
|
if self.http_thread:
|
|
327
333
|
self.http_thread.terminate()
|
|
334
|
+
finally:
|
|
335
|
+
if self.worker_finished_event:
|
|
336
|
+
self.worker_finished_event.set()
|
|
328
337
|
|
|
329
338
|
def run_sql(self):
|
|
330
339
|
pass
|
|
331
340
|
|
|
332
341
|
def join_with_exc(self, *args):
|
|
333
342
|
super().join(*args)
|
|
334
|
-
|
|
335
343
|
if self.exc:
|
|
336
344
|
raise self.exc
|
|
337
345
|
|
|
@@ -348,8 +356,11 @@ class ExaSQLExportThread(ExaSQLThread):
|
|
|
348
356
|
compression: bool,
|
|
349
357
|
query_or_table,
|
|
350
358
|
export_params: dict,
|
|
359
|
+
worker_finished_event: threading.Event | None = None,
|
|
351
360
|
):
|
|
352
|
-
super().__init__(
|
|
361
|
+
super().__init__(
|
|
362
|
+
connection, compression, worker_finished_event=worker_finished_event
|
|
363
|
+
)
|
|
353
364
|
|
|
354
365
|
self.query_or_table = query_or_table
|
|
355
366
|
self.params = export_params
|
|
@@ -390,8 +401,11 @@ class ExaSQLImportThread(ExaSQLThread):
|
|
|
390
401
|
compression: bool,
|
|
391
402
|
table: str,
|
|
392
403
|
import_params: dict,
|
|
404
|
+
worker_finished_event: threading.Event | None = None,
|
|
393
405
|
):
|
|
394
|
-
super().__init__(
|
|
406
|
+
super().__init__(
|
|
407
|
+
connection, compression, worker_finished_event=worker_finished_event
|
|
408
|
+
)
|
|
395
409
|
|
|
396
410
|
self.table = table
|
|
397
411
|
self.params = import_params
|
|
@@ -414,7 +428,14 @@ class ExaHttpThread(threading.Thread):
|
|
|
414
428
|
- https://pythonforthelab.com/blog/differences-between-multiprocessing-windows-and-linux/
|
|
415
429
|
"""
|
|
416
430
|
|
|
417
|
-
def __init__(
|
|
431
|
+
def __init__(
|
|
432
|
+
self,
|
|
433
|
+
ipaddr: str,
|
|
434
|
+
port: int,
|
|
435
|
+
compression: bool,
|
|
436
|
+
encryption: bool,
|
|
437
|
+
worker_finished_event: threading.Event | None = None,
|
|
438
|
+
):
|
|
418
439
|
self.server = ExaTCPServer(
|
|
419
440
|
(ipaddr, port),
|
|
420
441
|
ExaHttpRequestHandler,
|
|
@@ -424,6 +445,7 @@ class ExaHttpThread(threading.Thread):
|
|
|
424
445
|
|
|
425
446
|
self.read_pipe = self.server.read_pipe
|
|
426
447
|
self.write_pipe = self.server.write_pipe
|
|
448
|
+
self.worker_finished_event = worker_finished_event
|
|
427
449
|
|
|
428
450
|
self.exc = None
|
|
429
451
|
|
|
@@ -446,6 +468,8 @@ class ExaHttpThread(threading.Thread):
|
|
|
446
468
|
self.exc = e
|
|
447
469
|
finally:
|
|
448
470
|
self.server.server_close()
|
|
471
|
+
if self.worker_finished_event is not None:
|
|
472
|
+
self.worker_finished_event.set()
|
|
449
473
|
|
|
450
474
|
def join(self, timeout=None):
|
|
451
475
|
self.server.can_finish_get.set()
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|