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.0.tar.gz (11.1 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.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyqt_mysql_tools-0.1.0.tar.gz
  • Upload date:
  • Size: 11.1 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.0.tar.gz
Algorithm Hash digest
SHA256 fa6990ff29011a6e3effbad2c9eb54bbfc12081b212ca59c60b6923af3faf4a2
MD5 d3ab6025c54c1f8e8819cccfcafd4f06
BLAKE2b-256 3edee90ba78837da24e2995f4090a27ccb11b4484999848d966816ed55b2d713

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqt_mysql_tools-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 98a45d793536e2169c1c2d57f879c71d85028f56e1c226fa257152b75d4cf1d5
MD5 5609839b2686a32e904f6150a6eb67cd
BLAKE2b-256 5aa22bfbaad6cc838dc6d6f3339316b2bb716be216a9ec57a3a89ec14c9c143f

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