Metadata-Version: 2.1
Name: adsgenericfunctions
Version: 0.2.17
Summary: Generic functions
License: MIT
Author: Olivier Siguré
Author-email: olivier.sigure@alchimiedatasolutions.com
Requires-Python: >=3.09,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: psycopg2-binary (==2.9.5)
Requires-Dist: python-http-client (==3.3.7)
Requires-Dist: sendgrid (==6.10.0)
Requires-Dist: starkbank-ecdsa (==2.2.0)
Description-Content-Type: text/markdown

# Alchimie Data Solutions : Generic functions

The purpose of this Python package is to group together all the generic functions used in Onyx development.

## adsGenericFunctions

### class PostgresInput:
#### def __init__(self, database: str, user: str, password:str, port:str, host: str, batch_size=1000)

This class is used to communicate with a postgres database. Initialising the class starts the connection, so it needs the database name, user, password, port and host. It also sets the default read buffer to 1000.

#### def __del__(self)

This method just closes the connection to the database.

#### def read(self, query: str)

This method belongs to the PostgresInput class. It reads the parameter query and yield the results in batches of size `batch_size`.

#### def write(self, query: str, params=None)

This method belong to the PostgresInput class. It executes the parameter query, this query can be an insert, an update or a delete operation. We can add parameters to the execution by the parameter `params` set to None by default.

#### def send_mail(sgApiClient: str, destinataire: List[str], msg: str, from_email: str, subject: str) -> Response

This function sends an email to the `destinataire` from `from_email` with the subject `subject` and a message `msg`. It also needs the api key `sgApiClient`.
It returns the send response.

