atk-common 1.21.0__py3-none-any.whl → 1.23.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.
- atk_common/__init__.py +6 -2
- atk_common/datetime_utils.py +0 -3
- atk_common/db_utils.py +26 -0
- {atk_common-1.21.0.dist-info → atk_common-1.23.0.dist-info}/METADATA +1 -1
- {atk_common-1.21.0.dist-info → atk_common-1.23.0.dist-info}/RECORD +8 -8
- {atk_common-1.21.0.dist-info → atk_common-1.23.0.dist-info}/WHEEL +0 -0
- {atk_common-1.21.0.dist-info → atk_common-1.23.0.dist-info}/licenses/license.txt +0 -0
- {atk_common-1.21.0.dist-info → atk_common-1.23.0.dist-info}/top_level.txt +0 -0
atk_common/__init__.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# __init__.py
|
2
|
-
from atk_common.datetime_utils import
|
2
|
+
from atk_common.datetime_utils import get_utc_date_time, seconds_to_utc_timestamp, get_utc_date_from_iso
|
3
|
+
from atk_common.db_utils import sql, sql_with_record, convert_none_to_null, date_time_utc_column
|
3
4
|
from atk_common.env_utils import get_env_value
|
4
5
|
from atk_common.error_utils import get_message, create_error_log, get_error_entity, handle_error, get_response_error, get_error_type
|
5
6
|
from atk_common.http_utils import is_http_status_ok, is_http_status_internal, get_test_response
|
@@ -9,10 +10,13 @@ from atk_common.response_utils import create_response, is_response_ok
|
|
9
10
|
from atk_common.docker_utils import get_current_container_info
|
10
11
|
|
11
12
|
__all__ = [
|
12
|
-
'date_time_utc_column',
|
13
13
|
'get_utc_date_time',
|
14
14
|
'seconds_to_utc_timestamp',
|
15
15
|
'get_utc_date_from_iso',
|
16
|
+
'sql',
|
17
|
+
'sql_with_record',
|
18
|
+
'convert_none_to_null',
|
19
|
+
'date_time_utc_column',
|
16
20
|
'get_env_value',
|
17
21
|
'get_message',
|
18
22
|
'create_error_log',
|
atk_common/datetime_utils.py
CHANGED
atk_common/db_utils.py
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
import psycopg2
|
2
|
+
from psycopg2.extras import RealDictCursor
|
3
|
+
|
4
|
+
def sql(connection, sql, get_one):
|
5
|
+
with connection:
|
6
|
+
with connection.cursor(cursor_factory=RealDictCursor) as cursor:
|
7
|
+
cursor.execute(sql)
|
8
|
+
if get_one:
|
9
|
+
return cursor.fetchone()
|
10
|
+
return cursor.fetchall()
|
11
|
+
|
12
|
+
def sql_with_record(connection, sql, record):
|
13
|
+
with connection:
|
14
|
+
with connection.cursor(cursor_factory=RealDictCursor) as cursor:
|
15
|
+
cursor.execute(sql, record)
|
16
|
+
return cursor.fetchone()
|
17
|
+
|
18
|
+
def convert_none_to_null(value):
|
19
|
+
if value is None or value == '':
|
20
|
+
return 'null'
|
21
|
+
if type(value) is str:
|
22
|
+
return '\'' + value + '\''
|
23
|
+
return value
|
24
|
+
|
25
|
+
def date_time_utc_column(column):
|
26
|
+
return 'TO_CHAR({0} at time zone \'UTC\', \'yyyy-mm-dd hh24:mi:ss.ms"Z"\')'.format(column)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
atk_common/__init__.py,sha256=
|
2
|
-
atk_common/datetime_utils.py,sha256=
|
3
|
-
atk_common/db_utils.py,sha256=
|
1
|
+
atk_common/__init__.py,sha256=G2r5JTcOHLwHFrvpLC4L-t3JlilWQq8-oSDMeUF3AYA,1360
|
2
|
+
atk_common/datetime_utils.py,sha256=tMXB3ZuRG8GyA25YLaNXhs4cVHF5zWdw9fXOh0Z9kQw,379
|
3
|
+
atk_common/db_utils.py,sha256=6S-WlQltnYjrG0AJ1BXwLgkqT4T6cQmHnHI9ksCdy38,869
|
4
4
|
atk_common/docker_utils.py,sha256=nkUhp2OhwJsm41JDujHDY-JxQfdDjy91duprH59Esfk,2084
|
5
5
|
atk_common/env_utils.py,sha256=66v-S0vlkJNaun6ay1XcOGRtYJb4Ce4odJsWxuaHsQc,373
|
6
6
|
atk_common/error_utils.py,sha256=7SN-Jz3i2MGIPqsexnjgbZg5poMnALLEiCJQ4za5im4,2398
|
@@ -23,7 +23,7 @@ atk_common/enums/section_role_enum.py,sha256=9rwep4Wmvyvnlrey08TRRoi8VQYAPkylpP0
|
|
23
23
|
atk_common/enums/sensor_type_enum.py,sha256=UBa3LPyGTKgEJV578CqFlwXjnlXqVlybrvzdjsHhjSU,80
|
24
24
|
atk_common/enums/speed_control_status_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
|
25
25
|
atk_common/enums/violation_type_enum.py,sha256=01qTHOj-O8bOc-nwIHVnxLosm4cusD_YuqXM3ZsiRRk,86
|
26
|
-
atk_common-1.
|
26
|
+
atk_common-1.23.0.dist-info/licenses/license.txt,sha256=_0O6fWM00-wTurDjnZhUP_N5QiwGhItaQZqHq5eqadA,1063
|
27
27
|
atk_package/__init__.py,sha256=EceDa352WFHTdC_LxYANXf_TS9pGzK3MCx87bwAKTvg,811
|
28
28
|
atk_package/datetime_utils.py,sha256=qsVF7l90P1-xukG2tV_jLqG9J_Yfl5wTpyfrdPBlyMo,239
|
29
29
|
atk_package/env_utils.py,sha256=bXOrxM3fZUslqfmZt75iphbEJHbG4riJa8XOVzPwIII,313
|
@@ -36,7 +36,7 @@ atk_package/enums/__init__.py,sha256=oW0aVnwewfH6sNu14jjZ5_uP4iRN4pRmGdTNC204rHo
|
|
36
36
|
atk_package/enums/command_status_enum.py,sha256=M2Nln27a_DbzI07-gfytWQk2X087JhkU6Fmard5qVHs,127
|
37
37
|
atk_package/enums/speed_control_status_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
|
38
38
|
shared_python_atk_enforcement/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
39
|
-
atk_common-1.
|
40
|
-
atk_common-1.
|
41
|
-
atk_common-1.
|
42
|
-
atk_common-1.
|
39
|
+
atk_common-1.23.0.dist-info/METADATA,sha256=t7TM3cs6MvcRyPuUtrhyfWjOYjB1P3hat9siC2IkcOM,1464
|
40
|
+
atk_common-1.23.0.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
41
|
+
atk_common-1.23.0.dist-info/top_level.txt,sha256=4CwRjkLnheIdI4jQwc4tK3dbRc58WqUmoqjkdDTWlME,41
|
42
|
+
atk_common-1.23.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|