holado 0.6.0__py3-none-any.whl → 0.6.2__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.
Potentially problematic release.
This version of holado might be problematic. Click here for more details.
- {holado-0.6.0.dist-info → holado-0.6.2.dist-info}/METADATA +1 -1
- {holado-0.6.0.dist-info → holado-0.6.2.dist-info}/RECORD +8 -8
- holado_db/tools/db/clients/base/db_client.py +1 -1
- holado_db/tools/db/clients/postgresql/postgresql_client.py +12 -7
- holado_db/tools/db/query/pypika/pypika_query_builder.py +1 -2
- holado_docker/sdk/docker/docker_client.py +37 -4
- {holado-0.6.0.dist-info → holado-0.6.2.dist-info}/WHEEL +0 -0
- {holado-0.6.0.dist-info → holado-0.6.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -155,14 +155,14 @@ holado_db/tests/behave/steps/tools/db/postgresql_client_steps.py,sha256=HtO-NSlT
|
|
|
155
155
|
holado_db/tests/behave/steps/tools/db/sqlite_client_steps.py,sha256=6B8GGBJxxG6Z49cGCPykm8BP7nQQZWUrWpw0XgaYGaE,2930
|
|
156
156
|
holado_db/tools/db/db_manager.py,sha256=0llXc6YhXfLr6oNfncPNjh4_ZInIm8XYywutQYvvLso,5400
|
|
157
157
|
holado_db/tools/db/clients/base/db_audit.py,sha256=eJ1r_0YUhvq50JngpWAdyEeVHWjAD4YCvWCJsLc1zmc,4368
|
|
158
|
-
holado_db/tools/db/clients/base/db_client.py,sha256=
|
|
158
|
+
holado_db/tools/db/clients/base/db_client.py,sha256=sdMKDbnhO0zMCxq3n6vHcn5d5Asm6N5WhKDss89v_PU,15298
|
|
159
159
|
holado_db/tools/db/clients/postgresql/postgresql_audit.py,sha256=yoy4-Yt4lZHJw7xAcuTj2Thg4aTDCYJBt-6HzQeEE80,3939
|
|
160
|
-
holado_db/tools/db/clients/postgresql/postgresql_client.py,sha256=
|
|
160
|
+
holado_db/tools/db/clients/postgresql/postgresql_client.py,sha256=FW9t4kGh3ClDr1NfOymSMAYSrguPcKeqbwE6BM4ognI,4746
|
|
161
161
|
holado_db/tools/db/clients/sqlite/sqlite_audit.py,sha256=cK7hBE7aKCFOX5xnT-QnYD_1loQPgPP9Gf6qTT1XuI4,3966
|
|
162
162
|
holado_db/tools/db/clients/sqlite/sqlite_client.py,sha256=-EvKAeaOc1Iv_wmuAgvzpS5hEfDFvZgP9OkFc9L5M-s,2891
|
|
163
163
|
holado_db/tools/db/query/query_manager.py,sha256=7n-d_Q373hlsKQshY3accIH8XfqaLScqnhMdTT2oWC4,3642
|
|
164
164
|
holado_db/tools/db/query/base/query_builder.py,sha256=-nCyBe8zsRhOX39uCV0P7OY_YKobQJVIpJDL2sUA_H8,5926
|
|
165
|
-
holado_db/tools/db/query/pypika/pypika_query_builder.py,sha256=
|
|
165
|
+
holado_db/tools/db/query/pypika/pypika_query_builder.py,sha256=9x2-7B4p3eXSq3vLWWLscoFWJZakhcPxmNrpGR2ysdw,10964
|
|
166
166
|
holado_django/__init__.py,sha256=KpbIi2cm1BYZgoWf0LuhE0ei3ZCE15UcUtjC1cSA55M,1653
|
|
167
167
|
holado_django/server/HOWTO.txt,sha256=91z7uC1Hf_X6dNO2wxdqQFKG2U6wIIW6NKxirUglYOA,2085
|
|
168
168
|
holado_django/server/django_server.py,sha256=2nVH0WX99nGGH-c4QztfoC-zAJKmLrNTXvhTp4qsL08,4557
|
|
@@ -185,7 +185,7 @@ holado_django/server/django_projects/rest_api/rest_api/application/migrations/__
|
|
|
185
185
|
holado_django/tests/behave/steps/__init__.py,sha256=1x7ID0w53eDe1P-n4Y5XOnLOTg_bta54gZE2YI0-IHo,1281
|
|
186
186
|
holado_django/tests/behave/steps/django_server_steps.py,sha256=XAnKDUXJxsZ4L7-PYatjevh2BT3qdKIg5sXXG5Y3QFQ,3819
|
|
187
187
|
holado_docker/__init__.py,sha256=CtGYR7aEkaCdAHPDAsu_ErjpVtYE0yz9wbgbfRUwS8s,1574
|
|
188
|
-
holado_docker/sdk/docker/docker_client.py,sha256=
|
|
188
|
+
holado_docker/sdk/docker/docker_client.py,sha256=SnNIcLM4Slec81uJqlCn6r5NhT2MLdj_-lYs2O-P1X0,13792
|
|
189
189
|
holado_docker/sdk/docker/docker_service.py,sha256=SvMSIZ7XTCbC7q5rur03lJhJVSHL3uIq1dBQz9oDpkw,3767
|
|
190
190
|
holado_docker/tests/behave/steps/__init__.py,sha256=lrP0btKLA3qQD2wp3zbOp0ug8RmgpaYWCrOAWehcPiI,1298
|
|
191
191
|
holado_docker/tests/behave/steps/tools/docker_controller/client_steps.py,sha256=hgns0Kyl38jJlZsVpMtEWlQKfga815BfJRFS_JhQvWc,4438
|
|
@@ -605,7 +605,7 @@ test_holado/tools/django/api_rest/api_rest/api1/serializers.py,sha256=o_YxFr-tgC
|
|
|
605
605
|
test_holado/tools/django/api_rest/api_rest/api1/tests.py,sha256=mrbGGRNg5jwbTJtWWa7zSKdDyeB4vmgZCRc2nk6VY-g,60
|
|
606
606
|
test_holado/tools/django/api_rest/api_rest/api1/views.py,sha256=kOt2xT6bxO47_z__5yYR9kcYIWWv4qYzpX0K8Tqonik,758
|
|
607
607
|
test_holado/tools/django/api_rest/api_rest/api1/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
608
|
-
holado-0.6.
|
|
609
|
-
holado-0.6.
|
|
610
|
-
holado-0.6.
|
|
611
|
-
holado-0.6.
|
|
608
|
+
holado-0.6.2.dist-info/METADATA,sha256=-BSf1eXEHFtbGEN1IB-KhCayPLGj-uBMe1OVN9OlXRU,6166
|
|
609
|
+
holado-0.6.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
610
|
+
holado-0.6.2.dist-info/licenses/LICENSE,sha256=IgGmNlcFHnbp7UWrLJqAFvs_HIgjJDTmjCNRircJLsk,1070
|
|
611
|
+
holado-0.6.2.dist-info/RECORD,,
|
|
@@ -23,7 +23,6 @@ from holado_core.common.tables.table import Table
|
|
|
23
23
|
from holado_db.tools.db.query.base.query_builder import QueryBuilder
|
|
24
24
|
from holado_data.data.generator.base import BaseGenerator
|
|
25
25
|
from holado_python.standard_library.typing import Typing
|
|
26
|
-
import pypika.queries
|
|
27
26
|
|
|
28
27
|
logger = logging.getLogger(__name__)
|
|
29
28
|
|
|
@@ -223,6 +222,7 @@ class DBClient(object):
|
|
|
223
222
|
def is_query_type(self, sql_or_query, query_type):
|
|
224
223
|
from sql_metadata.keywords_lists import QueryType
|
|
225
224
|
import sql_metadata
|
|
225
|
+
import pypika.queries
|
|
226
226
|
|
|
227
227
|
if isinstance(sql_or_query, pypika.queries.QueryBuilder):
|
|
228
228
|
sql = self.query_builder.to_sql(sql_or_query)
|
|
@@ -15,9 +15,9 @@ import logging
|
|
|
15
15
|
from holado_db.tools.db.clients.base.db_client import DBClient
|
|
16
16
|
from holado_core.common.tables.table_with_header import TableWithHeader
|
|
17
17
|
from holado_core.common.tools.tools import Tools
|
|
18
|
-
import json
|
|
19
|
-
from pypika.terms import Function, LiteralValue
|
|
20
18
|
from holado_db.tools.db.clients.postgresql.postgresql_audit import PostgreSQLTriggerAuditManager
|
|
19
|
+
from holado_db.tools.db.query.pypika.pypika_query_builder import PypikaQueryBuilder
|
|
20
|
+
from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
21
21
|
|
|
22
22
|
logger = logging.getLogger(__name__)
|
|
23
23
|
|
|
@@ -29,11 +29,13 @@ except Exception as exc:
|
|
|
29
29
|
logger.debug(f"PostgreSQLClient is not available. Initialization failed on error: {exc}")
|
|
30
30
|
with_psycopg = False
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
if PypikaQueryBuilder.is_available():
|
|
33
|
+
from pypika.terms import Function, LiteralValue
|
|
34
|
+
|
|
35
|
+
# from pypika import Function
|
|
36
|
+
class JsonbSet(Function):
|
|
37
|
+
def __init__(self, name, *args, **kwargs):
|
|
38
|
+
super().__init__('jsonb_set', LiteralValue(name), *args, **kwargs)
|
|
37
39
|
|
|
38
40
|
|
|
39
41
|
class PostgreSQLClient(DBClient):
|
|
@@ -72,6 +74,9 @@ class PostgreSQLClient(DBClient):
|
|
|
72
74
|
if isinstance(result, TableWithHeader) and result[0][0].content is not None:
|
|
73
75
|
is_key_set = json_key in result[0][0].content
|
|
74
76
|
if is_key_set:
|
|
77
|
+
if not PypikaQueryBuilder.is_available():
|
|
78
|
+
# Note: This case cannot appear currently (04/08/2025), but can appear if another QueryBuilder is managed that is not using pypika
|
|
79
|
+
raise TechnicalException(f"Missing dependence: pypika")
|
|
75
80
|
self.update(table_name, {field_name: JsonbSet(f'{field_name}', f'{{"{json_key}"}}', f'"{json_value}"')}, where_data=where_data, where_compare_data=where_compare_data, do_commit=True)
|
|
76
81
|
else:
|
|
77
82
|
self.update(table_name, {field_name: f'{field_name} || {{"{json_key}":"{json_value}"}}'}, where_data=where_data, where_compare_data=where_compare_data, do_commit=True)
|
|
@@ -16,7 +16,6 @@ from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
|
16
16
|
from holado_db.tools.db.query.base.query_builder import QueryBuilder, DBCompareOperator
|
|
17
17
|
from holado_core.common.tools.tools import Tools
|
|
18
18
|
from holado_python.standard_library.typing import Typing
|
|
19
|
-
from pypika.terms import Function
|
|
20
19
|
|
|
21
20
|
|
|
22
21
|
logger = logging.getLogger(__name__)
|
|
@@ -24,7 +23,7 @@ logger = logging.getLogger(__name__)
|
|
|
24
23
|
try:
|
|
25
24
|
import pypika.functions
|
|
26
25
|
from pypika.queries import Table, Query
|
|
27
|
-
from pypika.terms import Parameter
|
|
26
|
+
from pypika.terms import Parameter, Function
|
|
28
27
|
with_pypika = True
|
|
29
28
|
except Exception as exc:
|
|
30
29
|
if Tools.do_log(logger, logging.DEBUG):
|
|
@@ -74,9 +74,27 @@ class DockerClient(object):
|
|
|
74
74
|
|
|
75
75
|
return self.__containers.get(name)
|
|
76
76
|
|
|
77
|
+
def update_containers(self, reset_if_removed=True):
|
|
78
|
+
# Add new containers
|
|
79
|
+
updated_names = set()
|
|
80
|
+
for c in self.__client.containers.list(all=True, sparse=True, ignore_removed=True):
|
|
81
|
+
try:
|
|
82
|
+
c_name = c.name
|
|
83
|
+
except docker.errors.NotFound:
|
|
84
|
+
# Container 'c' doesn't exist anymore
|
|
85
|
+
continue
|
|
86
|
+
|
|
87
|
+
if c_name not in self.__containers:
|
|
88
|
+
self.__containers[c_name] = DockerContainer(self, c)
|
|
89
|
+
updated_names.add(c_name)
|
|
90
|
+
|
|
91
|
+
if reset_if_removed:
|
|
92
|
+
for name in set(self.__containers.keys()).difference(updated_names):
|
|
93
|
+
del self.__containers[name]
|
|
94
|
+
|
|
77
95
|
def get_all_container_names(self):
|
|
78
96
|
res = []
|
|
79
|
-
for c in self.__client.containers.list(all=True):
|
|
97
|
+
for c in self.__client.containers.list(all=True, sparse=True, ignore_removed=True):
|
|
80
98
|
try:
|
|
81
99
|
c_name = c.name
|
|
82
100
|
except docker.errors.NotFound:
|
|
@@ -88,7 +106,7 @@ class DockerClient(object):
|
|
|
88
106
|
|
|
89
107
|
def __get_container_from_list(self, name):
|
|
90
108
|
res = None
|
|
91
|
-
for c in self.__client.containers.list(all=True):
|
|
109
|
+
for c in self.__client.containers.list(all=True, ignore_removed=True):
|
|
92
110
|
try:
|
|
93
111
|
c_name = c.name
|
|
94
112
|
except docker.errors.NotFound:
|
|
@@ -248,14 +266,22 @@ class DockerContainer(DeleteableObject):
|
|
|
248
266
|
self.__auto_stop = False
|
|
249
267
|
|
|
250
268
|
def _delete_object(self):
|
|
251
|
-
if self.auto_stop and self.__docker_client and self.__docker_client.has_container(self.name)
|
|
252
|
-
and self.__docker_client.get_container(self.name).status == "running":
|
|
269
|
+
if self.auto_stop and self.status == "running" and self.__docker_client and self.__docker_client.has_container(self.name):
|
|
253
270
|
self.__docker_client.stop_container(self.name)
|
|
254
271
|
|
|
255
272
|
@property
|
|
256
273
|
def container(self):
|
|
257
274
|
return self.__container
|
|
258
275
|
|
|
276
|
+
@property
|
|
277
|
+
def information(self):
|
|
278
|
+
try:
|
|
279
|
+
self.__container.reload()
|
|
280
|
+
except docker.errors.NotFound:
|
|
281
|
+
# Container doesn't exist anymore, use last known information
|
|
282
|
+
pass
|
|
283
|
+
return self.__container.attrs
|
|
284
|
+
|
|
259
285
|
@property
|
|
260
286
|
def status(self):
|
|
261
287
|
try:
|
|
@@ -272,6 +298,13 @@ class DockerContainer(DeleteableObject):
|
|
|
272
298
|
def auto_stop(self, auto_stop):
|
|
273
299
|
self.__auto_stop = auto_stop
|
|
274
300
|
|
|
301
|
+
def reload(self, ignore_removed=True):
|
|
302
|
+
try:
|
|
303
|
+
self.__container.reload()
|
|
304
|
+
except docker.errors.NotFound:
|
|
305
|
+
if not ignore_removed:
|
|
306
|
+
raise
|
|
307
|
+
|
|
275
308
|
def restart(self, **kwargs):
|
|
276
309
|
return self.__container.restart(**kwargs)
|
|
277
310
|
|
|
File without changes
|
|
File without changes
|