mbu-dev-shared-components 0.3.1__tar.gz → 0.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.
- mbu_dev_shared_components-0.3.2/PKG-INFO +79 -0
- mbu_dev_shared_components-0.3.2/README.md +60 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/solteqtand/db_handler.py +6 -3
- mbu_dev_shared_components-0.3.2/mbu_dev_shared_components.egg-info/PKG-INFO +79 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/pyproject.toml +1 -1
- mbu_dev_shared_components-0.3.1/PKG-INFO +0 -45
- mbu_dev_shared_components-0.3.1/README.md +0 -26
- mbu_dev_shared_components-0.3.1/mbu_dev_shared_components.egg-info/PKG-INFO +0 -45
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/LICENSE +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/getorganized/__init__.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/getorganized/auth.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/getorganized/cases.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/getorganized/contacts.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/getorganized/documents.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/getorganized/objects.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/google/__init__.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/google/api/__init__.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/google/api/auth.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/google/workspace/__init__.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/google/workspace/alerts.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/msoffice365/__init__.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/msoffice365/excel/__init__.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/msoffice365/excel/excel_reader.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/msoffice365/sharepoint_api/__init__.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/msoffice365/sharepoint_api/files.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/os2forms/__init__.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/os2forms/documents.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/os2forms/forms.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/sap/__init__.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/sap/create_invoice.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/solteqtand/__init__.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/solteqtand/app_handler.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/utils/__init__.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/utils/db_stored_procedure_executor.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/utils/fernet_encryptor.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/utils/file_handler.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components/utils/json_handler.py +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components.egg-info/SOURCES.txt +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components.egg-info/dependency_links.txt +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components.egg-info/requires.txt +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/mbu_dev_shared_components.egg-info/top_level.txt +0 -0
- {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.2}/setup.cfg +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: mbu_dev_shared_components
|
|
3
|
+
Version: 0.3.2
|
|
4
|
+
Summary: Shared components to use in RPA projects
|
|
5
|
+
Author-email: MBU <rpa@mbu.aarhus.dk>
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
9
|
+
Requires-Python: >=3.7
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: openpyxl>=3.1.2
|
|
13
|
+
Requires-Dist: pyodbc>=5.1.0
|
|
14
|
+
Requires-Dist: requests_ntlm>=1.2.0
|
|
15
|
+
Requires-Dist: python-dateutil==2.9.*
|
|
16
|
+
Requires-Dist: cryptography>=43.0.0
|
|
17
|
+
Requires-Dist: office365-rest-python-client
|
|
18
|
+
Requires-Dist: uiautomation
|
|
19
|
+
|
|
20
|
+
# MBU Dev Shared Components
|
|
21
|
+
|
|
22
|
+
[](https://badge.fury.io/py/mbu-dev-shared-components)
|
|
23
|
+
[](https://opensource.org/licenses/MIT)
|
|
24
|
+
|
|
25
|
+
## Overview
|
|
26
|
+
|
|
27
|
+
MBU Dev Shared Components is a Python library that provides helper modules to streamline Robotic Process Automation (RPA) development.
|
|
28
|
+
|
|
29
|
+
## Features
|
|
30
|
+
|
|
31
|
+
- **Office365 Integration**:
|
|
32
|
+
- SharePoint
|
|
33
|
+
- Excel
|
|
34
|
+
- **SAP Integration**
|
|
35
|
+
- **Solteq Tand Integration**
|
|
36
|
+
- **Utility Modules**:
|
|
37
|
+
- JSON handling
|
|
38
|
+
- Fernet encryption
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
Install the package using pip:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install mbu-dev-shared-components
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# Dynamic SQL Query Builder
|
|
49
|
+
|
|
50
|
+
This repository provides a **generic function** to dynamically build SQL `WHERE` clauses using filters. It supports:
|
|
51
|
+
|
|
52
|
+
- **Equality (`=`)**
|
|
53
|
+
- **LIKE (`%search%`)**
|
|
54
|
+
- **IN (`column IN (value1, value2, ...)`)**
|
|
55
|
+
- **BETWEEN (`column BETWEEN value1 AND value2`)**
|
|
56
|
+
- **AND & OR Conditions**
|
|
57
|
+
- **ORDER BY (`ORDER BY column ASC/DESC`)**
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 📌 How to Use the `check_if_event_exists` Function
|
|
62
|
+
|
|
63
|
+
| **Usage Type** | **Example Function Call** | **Generated SQL WHERE Clause** |
|
|
64
|
+
|--------------|--------------------------------------|--------------------------------------------|
|
|
65
|
+
| **1. Basic Equality Filtering** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890", "e.event_name": "Some Clinic"}) ``` | `WHERE 1=1 AND p.cpr = ? AND e.event_name = ?` |
|
|
66
|
+
| **2. LIKE Filtering** (Partial Match) | ```python self.check_if_event_exists(filters={"e.event_name": "%Clinic%"}) ``` | `WHERE 1=1 AND e.event_name LIKE ?` |
|
|
67
|
+
| **3. IN Filtering** (Multiple Values) | ```python self.check_if_event_exists(filters={"e.event_message": ["Scheduled", "Pending"]}) ``` | `WHERE 1=1 AND e.event_message IN (?, ?)` |
|
|
68
|
+
| **4. BETWEEN Filtering** (Range) | ```python self.check_if_event_exists(filters={"e.eventTriggerDate": ("2024-01-01", "2024-12-31")}) ``` | `WHERE 1=1 AND e.eventTriggerDate BETWEEN ? AND ?` |
|
|
69
|
+
| **5. Multiple AND Conditions** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890", "e.event_message": "Scheduled", "e.archived": 0}) ``` | `WHERE 1=1 AND p.cpr = ? AND e.event_message = ? AND e.archived = ?` |
|
|
70
|
+
| **6. OR Conditions (Single Group)** | ```python self.check_if_event_exists(or_filters=[{"e.event_name": "Clinic A"}, {"e.event_name": "Clinic B"}]) ``` | `WHERE 1=1 AND (e.event_name = ? OR e.event_name = ?)` |
|
|
71
|
+
| **7. OR with Multiple Conditions** | ```python self.check_if_event_exists(or_filters=[{"e.event_name": "Clinic A", "e.event_message": "Scheduled"}, {"e.event_name": "Clinic B"}]) ``` | `WHERE 1=1 AND ((e.event_name = ? AND e.event_message = ?) OR (e.event_name = ?))` |
|
|
72
|
+
| **8. AND & OR Combined** | ```python self.check_if_event_exists(filters={"e.archived": 0}, or_filters=[{"e.event_name": "Clinic A"}, {"e.event_name": "Clinic B"}]) ``` | `WHERE 1=1 AND e.archived = ? AND (e.event_name = ? OR e.event_name = ?)` |
|
|
73
|
+
| **9. LIKE with OR** | ```python self.check_if_event_exists(or_filters=[{"e.event_message": "%Scheduled%"}, {"e.event_message": "%Pending%"}]) ``` | `WHERE 1=1 AND (e.event_message LIKE ? OR e.event_message LIKE ?)` |
|
|
74
|
+
| **10. Complex AND, OR, LIKE, IN Combined** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890", "e.event_message": ["Scheduled", "Pending"]}, or_filters=[{"e.event_name": "%Hospital%"}, {"e.event_name": "%Clinic%"}]) ``` | `WHERE 1=1 AND p.cpr = ? AND e.event_message IN (?, ?) AND (e.event_name LIKE ? OR e.event_name LIKE ?)` |
|
|
75
|
+
| **11. ORDER BY (Ascending)** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890"}, order_by="e.timestamp", order_direction="ASC") ``` | `WHERE 1=1 AND p.cpr = ? ORDER BY e.timestamp ASC` |
|
|
76
|
+
| **12. ORDER BY (Descending)** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890"}, order_by="e.timestamp", order_direction="DESC") ``` | `WHERE 1=1 AND p.cpr = ? ORDER BY e.timestamp DESC` |
|
|
77
|
+
| **13. ORDER BY with Multiple Filters** | ```python self.check_if_event_exists(filters={"e.event_message": "Scheduled"}, order_by="e.eventTriggerDate", order_direction="DESC") ``` | `WHERE 1=1 AND e.event_message = ? ORDER BY e.eventTriggerDate DESC` |
|
|
78
|
+
|
|
79
|
+
---
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# MBU Dev Shared Components
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/py/mbu-dev-shared-components)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
MBU Dev Shared Components is a Python library that provides helper modules to streamline Robotic Process Automation (RPA) development.
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- **Office365 Integration**:
|
|
13
|
+
- SharePoint
|
|
14
|
+
- Excel
|
|
15
|
+
- **SAP Integration**
|
|
16
|
+
- **Solteq Tand Integration**
|
|
17
|
+
- **Utility Modules**:
|
|
18
|
+
- JSON handling
|
|
19
|
+
- Fernet encryption
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
Install the package using pip:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install mbu-dev-shared-components
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# Dynamic SQL Query Builder
|
|
30
|
+
|
|
31
|
+
This repository provides a **generic function** to dynamically build SQL `WHERE` clauses using filters. It supports:
|
|
32
|
+
|
|
33
|
+
- **Equality (`=`)**
|
|
34
|
+
- **LIKE (`%search%`)**
|
|
35
|
+
- **IN (`column IN (value1, value2, ...)`)**
|
|
36
|
+
- **BETWEEN (`column BETWEEN value1 AND value2`)**
|
|
37
|
+
- **AND & OR Conditions**
|
|
38
|
+
- **ORDER BY (`ORDER BY column ASC/DESC`)**
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 📌 How to Use the `check_if_event_exists` Function
|
|
43
|
+
|
|
44
|
+
| **Usage Type** | **Example Function Call** | **Generated SQL WHERE Clause** |
|
|
45
|
+
|--------------|--------------------------------------|--------------------------------------------|
|
|
46
|
+
| **1. Basic Equality Filtering** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890", "e.event_name": "Some Clinic"}) ``` | `WHERE 1=1 AND p.cpr = ? AND e.event_name = ?` |
|
|
47
|
+
| **2. LIKE Filtering** (Partial Match) | ```python self.check_if_event_exists(filters={"e.event_name": "%Clinic%"}) ``` | `WHERE 1=1 AND e.event_name LIKE ?` |
|
|
48
|
+
| **3. IN Filtering** (Multiple Values) | ```python self.check_if_event_exists(filters={"e.event_message": ["Scheduled", "Pending"]}) ``` | `WHERE 1=1 AND e.event_message IN (?, ?)` |
|
|
49
|
+
| **4. BETWEEN Filtering** (Range) | ```python self.check_if_event_exists(filters={"e.eventTriggerDate": ("2024-01-01", "2024-12-31")}) ``` | `WHERE 1=1 AND e.eventTriggerDate BETWEEN ? AND ?` |
|
|
50
|
+
| **5. Multiple AND Conditions** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890", "e.event_message": "Scheduled", "e.archived": 0}) ``` | `WHERE 1=1 AND p.cpr = ? AND e.event_message = ? AND e.archived = ?` |
|
|
51
|
+
| **6. OR Conditions (Single Group)** | ```python self.check_if_event_exists(or_filters=[{"e.event_name": "Clinic A"}, {"e.event_name": "Clinic B"}]) ``` | `WHERE 1=1 AND (e.event_name = ? OR e.event_name = ?)` |
|
|
52
|
+
| **7. OR with Multiple Conditions** | ```python self.check_if_event_exists(or_filters=[{"e.event_name": "Clinic A", "e.event_message": "Scheduled"}, {"e.event_name": "Clinic B"}]) ``` | `WHERE 1=1 AND ((e.event_name = ? AND e.event_message = ?) OR (e.event_name = ?))` |
|
|
53
|
+
| **8. AND & OR Combined** | ```python self.check_if_event_exists(filters={"e.archived": 0}, or_filters=[{"e.event_name": "Clinic A"}, {"e.event_name": "Clinic B"}]) ``` | `WHERE 1=1 AND e.archived = ? AND (e.event_name = ? OR e.event_name = ?)` |
|
|
54
|
+
| **9. LIKE with OR** | ```python self.check_if_event_exists(or_filters=[{"e.event_message": "%Scheduled%"}, {"e.event_message": "%Pending%"}]) ``` | `WHERE 1=1 AND (e.event_message LIKE ? OR e.event_message LIKE ?)` |
|
|
55
|
+
| **10. Complex AND, OR, LIKE, IN Combined** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890", "e.event_message": ["Scheduled", "Pending"]}, or_filters=[{"e.event_name": "%Hospital%"}, {"e.event_name": "%Clinic%"}]) ``` | `WHERE 1=1 AND p.cpr = ? AND e.event_message IN (?, ?) AND (e.event_name LIKE ? OR e.event_name LIKE ?)` |
|
|
56
|
+
| **11. ORDER BY (Ascending)** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890"}, order_by="e.timestamp", order_direction="ASC") ``` | `WHERE 1=1 AND p.cpr = ? ORDER BY e.timestamp ASC` |
|
|
57
|
+
| **12. ORDER BY (Descending)** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890"}, order_by="e.timestamp", order_direction="DESC") ``` | `WHERE 1=1 AND p.cpr = ? ORDER BY e.timestamp DESC` |
|
|
58
|
+
| **13. ORDER BY with Multiple Filters** | ```python self.check_if_event_exists(filters={"e.event_message": "Scheduled"}, order_by="e.eventTriggerDate", order_direction="DESC") ``` | `WHERE 1=1 AND e.event_message = ? ORDER BY e.eventTriggerDate DESC` |
|
|
59
|
+
|
|
60
|
+
---
|
|
@@ -5,8 +5,6 @@ an interface to interact with the Solteq Tand database.
|
|
|
5
5
|
import pyodbc
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
HUSK ORDER BY!!!!!
|
|
9
|
-
|
|
10
8
|
class SolteqTandDatabase:
|
|
11
9
|
"""Handles database operations related to the Solteq Tand system."""
|
|
12
10
|
|
|
@@ -40,7 +38,7 @@ class SolteqTandDatabase:
|
|
|
40
38
|
|
|
41
39
|
return result
|
|
42
40
|
|
|
43
|
-
def _construct_sql_statement(self, base_query, filters=None, or_filters=None): # noqa
|
|
41
|
+
def _construct_sql_statement(self, base_query, filters=None, or_filters=None, order_by=None, order_direction="ASC"): # noqa
|
|
44
42
|
"""
|
|
45
43
|
Dynamically constructs a SQL query by applying filters.
|
|
46
44
|
|
|
@@ -102,6 +100,11 @@ class SolteqTandDatabase:
|
|
|
102
100
|
if or_clauses:
|
|
103
101
|
base_query += " AND (" + " OR ".join(or_clauses) + ")"
|
|
104
102
|
|
|
103
|
+
# Adding ORDER BY clause
|
|
104
|
+
if order_by:
|
|
105
|
+
order_direction = "ASC" if order_direction.upper() not in ["ASC", "DESC"] else order_direction.upper()
|
|
106
|
+
base_query += f" ORDER BY {order_by} {order_direction}"
|
|
107
|
+
|
|
105
108
|
return base_query, params
|
|
106
109
|
|
|
107
110
|
def get_list_of_documents(self, filters=None, or_filters=None):
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: mbu_dev_shared_components
|
|
3
|
+
Version: 0.3.2
|
|
4
|
+
Summary: Shared components to use in RPA projects
|
|
5
|
+
Author-email: MBU <rpa@mbu.aarhus.dk>
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
9
|
+
Requires-Python: >=3.7
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: openpyxl>=3.1.2
|
|
13
|
+
Requires-Dist: pyodbc>=5.1.0
|
|
14
|
+
Requires-Dist: requests_ntlm>=1.2.0
|
|
15
|
+
Requires-Dist: python-dateutil==2.9.*
|
|
16
|
+
Requires-Dist: cryptography>=43.0.0
|
|
17
|
+
Requires-Dist: office365-rest-python-client
|
|
18
|
+
Requires-Dist: uiautomation
|
|
19
|
+
|
|
20
|
+
# MBU Dev Shared Components
|
|
21
|
+
|
|
22
|
+
[](https://badge.fury.io/py/mbu-dev-shared-components)
|
|
23
|
+
[](https://opensource.org/licenses/MIT)
|
|
24
|
+
|
|
25
|
+
## Overview
|
|
26
|
+
|
|
27
|
+
MBU Dev Shared Components is a Python library that provides helper modules to streamline Robotic Process Automation (RPA) development.
|
|
28
|
+
|
|
29
|
+
## Features
|
|
30
|
+
|
|
31
|
+
- **Office365 Integration**:
|
|
32
|
+
- SharePoint
|
|
33
|
+
- Excel
|
|
34
|
+
- **SAP Integration**
|
|
35
|
+
- **Solteq Tand Integration**
|
|
36
|
+
- **Utility Modules**:
|
|
37
|
+
- JSON handling
|
|
38
|
+
- Fernet encryption
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
Install the package using pip:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install mbu-dev-shared-components
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# Dynamic SQL Query Builder
|
|
49
|
+
|
|
50
|
+
This repository provides a **generic function** to dynamically build SQL `WHERE` clauses using filters. It supports:
|
|
51
|
+
|
|
52
|
+
- **Equality (`=`)**
|
|
53
|
+
- **LIKE (`%search%`)**
|
|
54
|
+
- **IN (`column IN (value1, value2, ...)`)**
|
|
55
|
+
- **BETWEEN (`column BETWEEN value1 AND value2`)**
|
|
56
|
+
- **AND & OR Conditions**
|
|
57
|
+
- **ORDER BY (`ORDER BY column ASC/DESC`)**
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 📌 How to Use the `check_if_event_exists` Function
|
|
62
|
+
|
|
63
|
+
| **Usage Type** | **Example Function Call** | **Generated SQL WHERE Clause** |
|
|
64
|
+
|--------------|--------------------------------------|--------------------------------------------|
|
|
65
|
+
| **1. Basic Equality Filtering** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890", "e.event_name": "Some Clinic"}) ``` | `WHERE 1=1 AND p.cpr = ? AND e.event_name = ?` |
|
|
66
|
+
| **2. LIKE Filtering** (Partial Match) | ```python self.check_if_event_exists(filters={"e.event_name": "%Clinic%"}) ``` | `WHERE 1=1 AND e.event_name LIKE ?` |
|
|
67
|
+
| **3. IN Filtering** (Multiple Values) | ```python self.check_if_event_exists(filters={"e.event_message": ["Scheduled", "Pending"]}) ``` | `WHERE 1=1 AND e.event_message IN (?, ?)` |
|
|
68
|
+
| **4. BETWEEN Filtering** (Range) | ```python self.check_if_event_exists(filters={"e.eventTriggerDate": ("2024-01-01", "2024-12-31")}) ``` | `WHERE 1=1 AND e.eventTriggerDate BETWEEN ? AND ?` |
|
|
69
|
+
| **5. Multiple AND Conditions** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890", "e.event_message": "Scheduled", "e.archived": 0}) ``` | `WHERE 1=1 AND p.cpr = ? AND e.event_message = ? AND e.archived = ?` |
|
|
70
|
+
| **6. OR Conditions (Single Group)** | ```python self.check_if_event_exists(or_filters=[{"e.event_name": "Clinic A"}, {"e.event_name": "Clinic B"}]) ``` | `WHERE 1=1 AND (e.event_name = ? OR e.event_name = ?)` |
|
|
71
|
+
| **7. OR with Multiple Conditions** | ```python self.check_if_event_exists(or_filters=[{"e.event_name": "Clinic A", "e.event_message": "Scheduled"}, {"e.event_name": "Clinic B"}]) ``` | `WHERE 1=1 AND ((e.event_name = ? AND e.event_message = ?) OR (e.event_name = ?))` |
|
|
72
|
+
| **8. AND & OR Combined** | ```python self.check_if_event_exists(filters={"e.archived": 0}, or_filters=[{"e.event_name": "Clinic A"}, {"e.event_name": "Clinic B"}]) ``` | `WHERE 1=1 AND e.archived = ? AND (e.event_name = ? OR e.event_name = ?)` |
|
|
73
|
+
| **9. LIKE with OR** | ```python self.check_if_event_exists(or_filters=[{"e.event_message": "%Scheduled%"}, {"e.event_message": "%Pending%"}]) ``` | `WHERE 1=1 AND (e.event_message LIKE ? OR e.event_message LIKE ?)` |
|
|
74
|
+
| **10. Complex AND, OR, LIKE, IN Combined** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890", "e.event_message": ["Scheduled", "Pending"]}, or_filters=[{"e.event_name": "%Hospital%"}, {"e.event_name": "%Clinic%"}]) ``` | `WHERE 1=1 AND p.cpr = ? AND e.event_message IN (?, ?) AND (e.event_name LIKE ? OR e.event_name LIKE ?)` |
|
|
75
|
+
| **11. ORDER BY (Ascending)** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890"}, order_by="e.timestamp", order_direction="ASC") ``` | `WHERE 1=1 AND p.cpr = ? ORDER BY e.timestamp ASC` |
|
|
76
|
+
| **12. ORDER BY (Descending)** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890"}, order_by="e.timestamp", order_direction="DESC") ``` | `WHERE 1=1 AND p.cpr = ? ORDER BY e.timestamp DESC` |
|
|
77
|
+
| **13. ORDER BY with Multiple Filters** | ```python self.check_if_event_exists(filters={"e.event_message": "Scheduled"}, order_by="e.eventTriggerDate", order_direction="DESC") ``` | `WHERE 1=1 AND e.event_message = ? ORDER BY e.eventTriggerDate DESC` |
|
|
78
|
+
|
|
79
|
+
---
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.2
|
|
2
|
-
Name: mbu_dev_shared_components
|
|
3
|
-
Version: 0.3.1
|
|
4
|
-
Summary: Shared components to use in RPA projects
|
|
5
|
-
Author-email: MBU <rpa@mbu.aarhus.dk>
|
|
6
|
-
Classifier: Programming Language :: Python :: 3
|
|
7
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
-
Classifier: Operating System :: Microsoft :: Windows
|
|
9
|
-
Requires-Python: >=3.7
|
|
10
|
-
Description-Content-Type: text/markdown
|
|
11
|
-
License-File: LICENSE
|
|
12
|
-
Requires-Dist: openpyxl>=3.1.2
|
|
13
|
-
Requires-Dist: pyodbc>=5.1.0
|
|
14
|
-
Requires-Dist: requests_ntlm>=1.2.0
|
|
15
|
-
Requires-Dist: python-dateutil==2.9.*
|
|
16
|
-
Requires-Dist: cryptography>=43.0.0
|
|
17
|
-
Requires-Dist: office365-rest-python-client
|
|
18
|
-
Requires-Dist: uiautomation
|
|
19
|
-
|
|
20
|
-
# MBU Dev Shared Components
|
|
21
|
-
|
|
22
|
-
[](https://badge.fury.io/py/mbu-dev-shared-components)
|
|
23
|
-
[](https://opensource.org/licenses/MIT)
|
|
24
|
-
|
|
25
|
-
## Overview
|
|
26
|
-
|
|
27
|
-
MBU Dev Shared Components is a Python library that provides helper modules to streamline Robotic Process Automation (RPA) development.
|
|
28
|
-
|
|
29
|
-
## Features
|
|
30
|
-
|
|
31
|
-
- **Office365 Integration**:
|
|
32
|
-
- SharePoint
|
|
33
|
-
- Excel
|
|
34
|
-
- **SAP Integration**
|
|
35
|
-
- **Solteq Tand Integration**
|
|
36
|
-
- **Utility Modules**:
|
|
37
|
-
- JSON handling
|
|
38
|
-
- Fernet encryption
|
|
39
|
-
|
|
40
|
-
## Installation
|
|
41
|
-
|
|
42
|
-
Install the package using pip:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
pip install mbu-dev-shared-components
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# MBU Dev Shared Components
|
|
2
|
-
|
|
3
|
-
[](https://badge.fury.io/py/mbu-dev-shared-components)
|
|
4
|
-
[](https://opensource.org/licenses/MIT)
|
|
5
|
-
|
|
6
|
-
## Overview
|
|
7
|
-
|
|
8
|
-
MBU Dev Shared Components is a Python library that provides helper modules to streamline Robotic Process Automation (RPA) development.
|
|
9
|
-
|
|
10
|
-
## Features
|
|
11
|
-
|
|
12
|
-
- **Office365 Integration**:
|
|
13
|
-
- SharePoint
|
|
14
|
-
- Excel
|
|
15
|
-
- **SAP Integration**
|
|
16
|
-
- **Solteq Tand Integration**
|
|
17
|
-
- **Utility Modules**:
|
|
18
|
-
- JSON handling
|
|
19
|
-
- Fernet encryption
|
|
20
|
-
|
|
21
|
-
## Installation
|
|
22
|
-
|
|
23
|
-
Install the package using pip:
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
pip install mbu-dev-shared-components
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.2
|
|
2
|
-
Name: mbu_dev_shared_components
|
|
3
|
-
Version: 0.3.1
|
|
4
|
-
Summary: Shared components to use in RPA projects
|
|
5
|
-
Author-email: MBU <rpa@mbu.aarhus.dk>
|
|
6
|
-
Classifier: Programming Language :: Python :: 3
|
|
7
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
-
Classifier: Operating System :: Microsoft :: Windows
|
|
9
|
-
Requires-Python: >=3.7
|
|
10
|
-
Description-Content-Type: text/markdown
|
|
11
|
-
License-File: LICENSE
|
|
12
|
-
Requires-Dist: openpyxl>=3.1.2
|
|
13
|
-
Requires-Dist: pyodbc>=5.1.0
|
|
14
|
-
Requires-Dist: requests_ntlm>=1.2.0
|
|
15
|
-
Requires-Dist: python-dateutil==2.9.*
|
|
16
|
-
Requires-Dist: cryptography>=43.0.0
|
|
17
|
-
Requires-Dist: office365-rest-python-client
|
|
18
|
-
Requires-Dist: uiautomation
|
|
19
|
-
|
|
20
|
-
# MBU Dev Shared Components
|
|
21
|
-
|
|
22
|
-
[](https://badge.fury.io/py/mbu-dev-shared-components)
|
|
23
|
-
[](https://opensource.org/licenses/MIT)
|
|
24
|
-
|
|
25
|
-
## Overview
|
|
26
|
-
|
|
27
|
-
MBU Dev Shared Components is a Python library that provides helper modules to streamline Robotic Process Automation (RPA) development.
|
|
28
|
-
|
|
29
|
-
## Features
|
|
30
|
-
|
|
31
|
-
- **Office365 Integration**:
|
|
32
|
-
- SharePoint
|
|
33
|
-
- Excel
|
|
34
|
-
- **SAP Integration**
|
|
35
|
-
- **Solteq Tand Integration**
|
|
36
|
-
- **Utility Modules**:
|
|
37
|
-
- JSON handling
|
|
38
|
-
- Fernet encryption
|
|
39
|
-
|
|
40
|
-
## Installation
|
|
41
|
-
|
|
42
|
-
Install the package using pip:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
pip install mbu-dev-shared-components
|
|
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
|