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

Uploaded Python 3

File details

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

File metadata

  • Download URL: sspart_py_lib-0.1.1.tar.gz
  • Upload date:
  • Size: 6.9 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-0.1.1.tar.gz
Algorithm Hash digest
SHA256 886845b7e55abbbbc9bf8696cf1def05d2aa36b1cfcbe754de173bedacf567c8
MD5 28fefd999c0510baef73eb3c3083603a
BLAKE2b-256 6d5a2ab3e4b08e4931c8bcf677c2fbe027ac8a14d0e0f3dfc6e0af09690de33b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sspart_py_lib-0.1.1-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-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 167ff042b51984bf6fa09ad0aa78c4efb88d7ab9c59209814b79669df54cc5f8
MD5 d5875825f7d3be6035307181617d2023
BLAKE2b-256 6b13f0bf45e9f39a69c7ecf2c3bce1471e1404f0013daf052bf6b9e4d8a6186a

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