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_HOSTMYSQL_PORTMYSQL_USERMYSQL_PASSWORDMYSQL_DATABASEMYSQL_CHARSET
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa6990ff29011a6e3effbad2c9eb54bbfc12081b212ca59c60b6923af3faf4a2
|
|
| MD5 |
d3ab6025c54c1f8e8819cccfcafd4f06
|
|
| BLAKE2b-256 |
3edee90ba78837da24e2995f4090a27ccb11b4484999848d966816ed55b2d713
|
File details
Details for the file pyqt_mysql_tools-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyqt_mysql_tools-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98a45d793536e2169c1c2d57f879c71d85028f56e1c226fa257152b75d4cf1d5
|
|
| MD5 |
5609839b2686a32e904f6150a6eb67cd
|
|
| BLAKE2b-256 |
5aa22bfbaad6cc838dc6d6f3339316b2bb716be216a9ec57a3a89ec14c9c143f
|