This release is a pre-release and may not be stable for production use.
opsmate-tool-mysql
opsmate-tool-mysql is a tool for Opsmate that allows you to interact with MySQL databases with the assistance of a LLM.
Should I use this tool?
:warning: This is an early prototype and the protocol is yet to be finalized. :warning:
Here is the guide to help you to make decisions about whether you should use this tool at the moment:
| Situation | Recommendation |
|---|---|
| I am not sure if this tool is mature enough for my use case | Don't use it |
| I want this tool to perform all the production db administration tasks for me | Absolutely not |
| There is a pressing production issue that needs to be resolved urgently, this mysql plugin might be useful | Seriously NO |
| I really want to use this tool but I'm worried about PII and data privacy implications | Don't use it |
| I have a non-production database and I want to test this tool | Maybe |
Installation
Change directory to this folder and run:
opsmate install opsmate-tool-mysql
Usage
First, start the MySQL server using docker-compose:
Note we have a x-for-pet database schema and sample data in the fixtures/mydb.sql file.
docker compose -f fixtures/docker-compose.yml up
Then you can test the tool by running:
opsmate chat\
--runtime-mysql-password my-secret-pw \
--runtime-mysql-host localhost \
--tools MySQLTool
Implementation Details
The tool is implemented in the mysql/tool.py file.
The tool uses the MySQLRuntime class to connect to the MySQL server, which is implements the Runtime interface. It is implemented in the mysql/runtime.py file.
In the pyproject.toml file you can find the entry points for the tool and the runtime:
[project.entry-points."opsmate.tools"]
tool = "mysql.tool:MySQLTool"
[project.entry-points."opsmate.runtime.runtimes"]
runtime = "mysql.runtime:MySQLRuntime"
This is to make sure that the tools are "autodiscovered" by Opsmate on startup. To verify this you can run the following commands:
# to verify the mysql tool is autodiscovered
opsmate list-tools | grep -i mysql
│ MySQLTool │ MySQL tool
# to verify the mysql runtime is autodiscovered
opsmate chat --help | grep -i mysql
--runtime-mysql-timeout INTEGER
The timeout of the MySQL server (env:
RUNTIME_MYSQL_TIMEOUT) [default: 120]
--runtime-mysql-charset TEXT The charset of the MySQL server (env:
RUNTIME_MYSQL_CHARSET) [default: utf8mb4]
--runtime-mysql-database TEXT The database of the MySQL server (env:
RUNTIME_MYSQL_DATABASE)
--runtime-mysql-password TEXT The password of the MySQL server (env:
RUNTIME_MYSQL_PASSWORD) [default: ""]
--runtime-mysql-user TEXT The user of the MySQL server (env:
RUNTIME_MYSQL_USER) [default: root]
--runtime-mysql-port INTEGER The port of the MySQL server (env:
RUNTIME_MYSQL_PORT) [default: 3306]
--runtime-mysql-host TEXT The host of the MySQL server (env:
RUNTIME_MYSQL_HOST) [default: localhost]
Uninstall
opsmate uninstall -y opsmate-tool-mysql
Metadata
Release files for opsmate-tool-mysql 0.1.2a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| opsmate_tool_mysql-0.1.2a0.tar.gz | 9.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opsmate_tool_mysql-0.1.2a0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.7 kB
Release files / opsmate_tool_mysql-0.1.2a0.tar.gz
| Download URL | opsmate_tool_mysql-0.1.2a0.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e0f2e095c0937850ed9dc7d14f0405f3a987171cc4043c93ef1eb56710d8b6ef
|
|
BLAKE2b-256 checksum How to use checksums |
39d42737b57f8d399d8e999cc03e0ddc29b1858f38e69b7a680274f03028ca14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 9, 2025.
Transparency logRelease files / opsmate_tool_mysql-0.1.2a0-py3-none-any.whl
| Download URL | opsmate_tool_mysql-0.1.2a0-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f7655436734f404f3243ef953fec1fd718578c8f051445a8771669bb3cba1451
|
|
BLAKE2b-256 checksum How to use checksums |
9006061b34ce9c21050cc13249d25aab243e00bab2b56d76705324a91fd19115
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 9, 2025.
Transparency log