Skip to main content

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


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.3.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

sspart_py_lib-1.0.3-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file sspart_py_lib-1.0.3.tar.gz.

File metadata

  • Download URL: sspart_py_lib-1.0.3.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for sspart_py_lib-1.0.3.tar.gz
Algorithm Hash digest
SHA256 40bc2869ace9630f2d1c554cfef958c2c7767354020f24f0f1b13b236b7e8d72
MD5 e4961c011a76fac56d92c4aebb0e8b8f
BLAKE2b-256 cba28f4b28ce8b0157c5f22829bef59c9a821d96b4684db16d1141ca0776afd5

See more details on using hashes here.

File details

Details for the file sspart_py_lib-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: sspart_py_lib-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for sspart_py_lib-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f669db5555b96f4f1e37c66ae3fb202e4d3e151fb98c75e4c66dcbc9b2d8095b
MD5 7716ac954c6f8f202b3cb9c475f18cfb
BLAKE2b-256 1a737d2d204171320440d27ceaaf2c2e8218182c996327bba6bad621a21249db

See more details on using hashes here.

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