Reusable Python library with PostgreSQL, ClickHouse, and Telegram helpers.
Project description
sspart-py-lib
Reusable Python library package for:
- PostgreSQL
- ClickHouse
- Telegram
1) Create virtual environment and install locally
python -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -e .
2) Use in another project
Option A: install from local path
pip install /absolute/path/to/sspart-py-lib
Option B: install in editable mode during development
pip install -e /absolute/path/to/sspart-py-lib
3) Quick usage
from sspart_py_lib import PostgresClient, ClickHouseClient, TelegramClient
pg = PostgresClient("postgresql://user:pass@localhost:5432/app")
result = pg.execute("INSERT INTO events(name) VALUES (%s)", ("boot",))
print(result.rowcount, result.status_message)
rows = pg.fetch_all("SELECT NOW()")
ch = ClickHouseClient(host="localhost", port=8123, username="default", password="")
result = ch.query("SELECT version()")
bot = TelegramClient("<telegram-bot-token>")
# await bot.send_text(chat_id=123456, text="Hello from sspart-py-lib")
Project structure
sspart-py-lib/
pyproject.toml
README.md
src/
sspart_py_lib/
__init__.py
postgres.py
clickhouse.py
telegram.py
Next improvements (later)
- Add retries / timeouts configuration
- Add connection pooling
- Add structured logging
- Add integration tests with Docker
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sspart_py_lib-1.0.0.tar.gz
(6.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sspart_py_lib-1.0.0.tar.gz.
File metadata
- Download URL: sspart_py_lib-1.0.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e311e9ace80e320968ee3345db983776e29f5c6b933519a7f15d9725dc2bb234
|
|
| MD5 |
d093eb23cda0651ed5369439bb6f08fc
|
|
| BLAKE2b-256 |
c5000412a0ddbc15b5313cfeb47975403e2396b88fe6be2b6d49bdeaf74c81be
|
File details
Details for the file sspart_py_lib-1.0.0-py3-none-any.whl.
File metadata
- Download URL: sspart_py_lib-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb14c90ed4954942976d2fbc086406441f0fe10d6a448f32e839d18ee79d2238
|
|
| MD5 |
995597b806df195b61bf6b7ffbf196ba
|
|
| BLAKE2b-256 |
8b97e534645fdc3599c90a695365379021914c091ba9b4f0ae28f24ca8bcb5a3
|