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.2.tar.gz (6.4 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.2-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sspart_py_lib-1.0.2.tar.gz
  • Upload date:
  • Size: 6.4 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.2.tar.gz
Algorithm Hash digest
SHA256 f909a9b1527b2227b5ffc079e6f8c947408e11642b976b41596f3bce3a46b2a3
MD5 abc1c40b9220e6a5b92df82c06c0dafa
BLAKE2b-256 0eb4d211677df8b917771c03bc52b82cfa1dcfabb564278f336e76f276edccf9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sspart_py_lib-1.0.2-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

Hashes for sspart_py_lib-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e1a8257edcb3ba8f6c8f8b136d2497a4ec530bb37d739184022d8db3295ce5d5
MD5 9477368482795fb56439e0b700cd7059
BLAKE2b-256 33b9bed2124c92b22c6b17fe4280279466ea04ab13c7cd4ada9be0b957a0f78f

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