Skip to main content

Small helpers for using PyMySQL safely from PyQt applications.

Project description

pyqt-mysql-tools

Helpers for building PyQt applications that talk to MySQL through PyMySQL.

Install for PyQt6:

pip install "pyqt-mysql-tools[pyqt6]"

Install for PyQt5:

pip install "pyqt-mysql-tools[pyqt5]"

Use it from Python as pyqt_mysql_tools:

from pyqt_mysql_tools import ConnectionConfig, MySqlClient

config = ConnectionConfig(
    host="localhost",
    user="root",
    password="password",
    database="app_db",
)

client = MySqlClient(config)
rows = client.fetch_all("select id, name from users where active = %s", (True,))

Run a query from a Qt worker:

from pyqt_mysql_tools import ConnectionConfig, QueryWorker

worker = QueryWorker(
    ConnectionConfig.from_env(),
    "select id, name from users limit 10",
)
worker.finished.connect(print)
worker.failed.connect(lambda exc: print(f"Query failed: {exc}"))

Environment variables supported by ConnectionConfig.from_env():

  • MYSQL_HOST
  • MYSQL_PORT
  • MYSQL_USER
  • MYSQL_PASSWORD
  • MYSQL_DATABASE
  • MYSQL_CHARSET

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

pyqt_mysql_tools-0.1.1.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

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

pyqt_mysql_tools-0.1.1-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyqt_mysql_tools-0.1.1.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for pyqt_mysql_tools-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0ed863528fd54069aa3c1be20d207047d9f8a2e9638d8535827430364f4fd108
MD5 40922d8393a7ea89b7591d388c6272d7
BLAKE2b-256 895b7fedff3df764f7d9bc7bb7b00ef546c62d98ca87b95dff82b0949d0ed4c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqt_mysql_tools-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 668b611e795b3b728803eb651b113fdc4f3f23f4d4b26b2994911472ea5b330b
MD5 67a70377677db98135f0d8fb8f426dae
BLAKE2b-256 e9bada6a0192d478ba6d9a568975eea4553a0eeb83f7a16a2ff365549e73aeb9

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