# connection-helper

![PyPI - Version](https://img.shields.io/pypi/v/connection-helper) ![GitHub last commit](https://img.shields.io/github/last-commit/smeisegeier/connection-helper?logo=github) ![GitHub License](https://img.shields.io/github/license/smeisegeier/connection-helper?logo=github) ![py](https://img.shields.io/badge/python-3.10_|_3.11_|_3.12-blue.svg?logo=data:image/svg+xml;base64, )

## usage

install / update package

```bash
pip install connection-helper -U
```

include in python

```python
from connection_helper import sql, pgp
```

## why use connection-helper

`connection-helper` bundles some packages for connecting to sql databases

- `sql` is added as convenience wrapper for retrieving data from sql databases
  - `connect_sql()` to get get data from `['mssql', 'sqlite','postgres']`
  - `load_sql_to_sqlite` connect to a sql db and transfer a list of tables to `sqlite`
  - `load_sqlite_to_parquet()` to get all tables from a sqlite file as parquets
  - `unpack_files_to_duckdb()` return a tuple of all files of a dir (csv or parquet) into high performance duckdb objects ⚡
  - [ ] azure storage connector 🚧

- `pgp` cryptographic tools adapted from [python-gnupg](https://github.com/vsajip/python-gnupg). this is a wrapper around `gnupg`, but only offers some cenvenience or tailored options. feel free to use the original library or the [GNU Privacy Guard](https://gnupg.org/).
  - `encrypt()` a message for one or more recipient(s) with a public key
  - `decrypt()` a message with a private key. Passphrase must be provided via env variable
  - `find_key()` in keyring
  - ...

> 💡 These methods require a pgp public/private key in the keyring

- `sec` secrets module. ⚠️ this package is optional and must be extra installed with `pip install connection-helper[sec]`
  - 🆕 `get_infisical_secrets()` retrieve secrets from [Infisical](https://infisical.com/) project (requires existing account and machine identities)
