Skip to main content

Shared components to use in RPA projects

Project description

MBU Dev Shared Components

PyPI version License: MIT

Overview

MBU Dev Shared Components is a Python library that provides helper modules to streamline Robotic Process Automation (RPA) development.

Features

  • Office365 Integration:
    • SharePoint
    • Excel
  • SAP Integration
  • Solteq Tand Integration
  • Utility Modules:
    • JSON handling
    • Fernet encryption

Installation

Install the package using pip:

pip install mbu-dev-shared-components


# Dynamic SQL Query Builder

This repository provides a **generic function** to dynamically build SQL `WHERE` clauses using filters. It supports:

- **Equality (`=`)**  
- **LIKE (`%search%`)**  
- **IN (`column IN (value1, value2, ...)`)**  
- **BETWEEN (`column BETWEEN value1 AND value2`)**  
- **AND & OR Conditions**  
- **ORDER BY (`ORDER BY column ASC/DESC`)**  

---

## 📌 How to Use the `check_if_event_exists` Function

| **Usage Type** | **Example Function Call** | **Generated SQL WHERE Clause** |
|--------------|--------------------------------------|--------------------------------------------|
| **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 = ?` |
| **2. LIKE Filtering** (Partial Match) | ```python self.check_if_event_exists(filters={"e.event_name": "%Clinic%"}) ``` | `WHERE 1=1 AND e.event_name LIKE ?` |
| **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 (?, ?)` |
| **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 ?` |
| **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 = ?` |
| **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 = ?)` |
| **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 = ?))` |
| **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 = ?)` |
| **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 ?)` |
| **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 ?)` |
| **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` |
| **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` |
| **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` |
=======

Project details


Release history Release notifications | RSS feed

This version

4.2.3

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mbu_dev_shared_components-4.2.3.tar.gz (48.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mbu_dev_shared_components-4.2.3-py3-none-any.whl (64.2 kB view details)

Uploaded Python 3

File details

Details for the file mbu_dev_shared_components-4.2.3.tar.gz.

File metadata

File hashes

Hashes for mbu_dev_shared_components-4.2.3.tar.gz
Algorithm Hash digest
SHA256 2634c5a80eade8f84f3d3322342fc5a6bb5f36f0fabc3bbd1a90410da0554b75
MD5 ee0b4c4028ef9bc9629823038385cc91
BLAKE2b-256 c213d92f570560183d5c8c95fc3971ff9b775de02726d3cab3633aa091d852a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for mbu_dev_shared_components-4.2.3.tar.gz:

Publisher: publish_to_pypi.yml on AAK-MBU/MBU-dev-shared-components

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mbu_dev_shared_components-4.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for mbu_dev_shared_components-4.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 07887753f8743f18fcc4fd4d000a3768c549d9883da8e4aa1060fa4db275fe96
MD5 3416caa47503075c7de4086db026ddbb
BLAKE2b-256 96ace0ddabd5b89ea8b7d95a44b7ebb7975d85814d1a7cf64623583bc20f4fd5

See more details on using hashes here.

Provenance

The following attestation bundles were made for mbu_dev_shared_components-4.2.3-py3-none-any.whl:

Publisher: publish_to_pypi.yml on AAK-MBU/MBU-dev-shared-components

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page