mbu-dev-shared-components 0.0.42__tar.gz → 0.0.44__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.
- {mbu_dev_shared_components-0.0.42/mbu_dev_shared_components.egg-info → mbu_dev_shared_components-0.0.44}/PKG-INFO +1 -1
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/utils/db_stored_procedure_executor.py +6 -15
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44/mbu_dev_shared_components.egg-info}/PKG-INFO +1 -1
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/.gitignore +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/LICENSE +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/README.md +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/getorganized/__init__.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/getorganized/auth.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/getorganized/cases.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/getorganized/contacts.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/getorganized/documents.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/getorganized/objects.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/google/__init__.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/google/api/__init__.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/google/api/auth.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/google/workspace/__init__.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/google/workspace/alerts.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/office365/__init__.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/office365/excel/__init__.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/office365/excel/excel_reader.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/office365/sharepoint_api/__init__.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/office365/sharepoint_api/files.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/os2forms/__init__.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/os2forms/documents.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/sap/__init__.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/sap/create_invoice.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/utils/__init__.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components/utils/json_handler.py +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components.egg-info/SOURCES.txt +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components.egg-info/dependency_links.txt +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components.egg-info/requires.txt +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/mbu_dev_shared_components.egg-info/top_level.txt +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/pyproject.toml +0 -0
- {mbu_dev_shared_components-0.0.42 → mbu_dev_shared_components-0.0.44}/setup.cfg +0 -0
|
@@ -3,19 +3,13 @@ This module contains a generic function for executing stored procedures in a dat
|
|
|
3
3
|
via the pyodbc library. The function connects to the database and executes the stored
|
|
4
4
|
procedure with provided parameters, returning the success status and any error messages.
|
|
5
5
|
"""
|
|
6
|
+
import json
|
|
6
7
|
from typing import Dict, Any, Union
|
|
7
8
|
from dateutil import parser
|
|
8
9
|
import pyodbc
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
def
|
|
12
|
-
"""Format datetime object to string if not None"""
|
|
13
|
-
return dt.isoformat() if dt else None
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def execute_stored_procedure(connection_string: str,
|
|
17
|
-
stored_procedure: str,
|
|
18
|
-
params: Dict[str, Any]) -> Dict[str, Union[bool, str, Any]]:
|
|
12
|
+
def execute_stored_procedure(connection_string: str, stored_procedure: str, params: Dict[str, Any]) -> Dict[str, Union[bool, str, Any]]:
|
|
19
13
|
"""
|
|
20
14
|
Executes a stored procedure with the given parameters.
|
|
21
15
|
|
|
@@ -38,8 +32,8 @@ def execute_stored_procedure(connection_string: str,
|
|
|
38
32
|
"str": str,
|
|
39
33
|
"int": int,
|
|
40
34
|
"float": float,
|
|
41
|
-
"datetime": lambda x:
|
|
42
|
-
|
|
35
|
+
"datetime": lambda x: parser.isoparse(x),
|
|
36
|
+
"json": lambda x: json.dumps(x, ensure_ascii=False)
|
|
43
37
|
}
|
|
44
38
|
|
|
45
39
|
try:
|
|
@@ -48,14 +42,11 @@ def execute_stored_procedure(connection_string: str,
|
|
|
48
42
|
param_placeholders = ', '.join([f"@{key} = ?" for key in params.keys()])
|
|
49
43
|
param_values = []
|
|
50
44
|
|
|
51
|
-
for
|
|
45
|
+
for key, value in params.items():
|
|
52
46
|
if isinstance(value, tuple) and len(value) == 2:
|
|
53
47
|
value_type, actual_value = value
|
|
54
48
|
if value_type in type_mapping:
|
|
55
|
-
|
|
56
|
-
param_values.append(type_mapping[value_type](actual_value))
|
|
57
|
-
else:
|
|
58
|
-
param_values.append(None)
|
|
49
|
+
param_values.append(type_mapping[value_type](actual_value))
|
|
59
50
|
else:
|
|
60
51
|
param_values.append(actual_value)
|
|
61
52
|
else:
|
|
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
|