Skip to main content

MySQL Shell Python client

CI/CD Status Coverage Status Apache license

MySQL Shell is an advanced client for MySQL Server that allow system administrator to perform both cluster and instance level operations, using a single binary.

This project provides a Python client to perform the most common set of operations, in addition to a set of predefined queries to cover most of the common use-cases.

🧑‍💻 Usage

  1. Install MySQL Shell.

  2. Install the package from PyPi:

    pip install mysql-shell-client
    
  3. Import and build the executors:

    from mysql_shell.executors import LocalExecutor
    from mysql_shell.models import ConnectionDetails
    
    cluster_conn = ConnectionDetails(
        username="...",
        password="...",
        host="...",
        port="...",
    )
    instance_conn = ConnectionDetails(
        username="...",
        password="...",
        host="...",
        port="...",
    )
    
    cluster_executor = LocalExecutor(cluster_conn, "mysqlsh")
    instance_executor = LocalExecutor(instance_conn, "mysqlsh")
    
  4. Import and build the clients:

    from mysql_shell.builders.quoting import ArgsQuoter, QueryQuoter
    from mysql_shell.clients import ClusterClient, InstanceClient
    
    args_quoter = ArgsQuoter()
    query_quoter = QueryQuoter()
    
    cluster_client = ClusterClient(cluster_executor, args_quoter)
    instance_client = InstanceClient(instance_executor, query_quoter)
    

🔧 Development

Dependencies

In order to install all the required packages:

poetry install --all-extras

Linting

All Python files are linted using Ruff, to run it:

tox -e lint

Testing

Project testing is performed using Pytest, to run them:

tox -e unit
export MYSQL_DATABASE="test"
export MYSQL_USERNAME="root"
export MYSQL_PASSWORD="root_pass"
export MYSQL_SHELL_PATH="mysqlsh"

sudo --preserve-env docker compose -f compose/mysql-8.0.yaml up --wait && tox -e integration
sudo --preserve-env docker compose -f compose/mysql-8.0.yaml down

Release

Commits can be tagged to create releases of the package, in order to do so:

  1. Bump up the version within the pyproject.toml file.
  2. Add a new section to the CHANGELOG.md.
  3. Commit + push the changes.
  4. Trigger the release workflow.

Metadata

Release files for mysql-shell-client 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mysql-shell-client 2.0.0
File Size Uploaded
mysql_shell_client-2.0.0.tar.gz 20.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mysql-shell-client 2.0.0
File Interpreter ABI Platform
mysql_shell_client-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 50.8 kB

Release files / mysql_shell_client-2.0.0.tar.gz

Download URL mysql_shell_client-2.0.0.tar.gz
Size 20.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f95c666ffc99bb36cae03d089c4d1d4cb29443ab4729f17737ec54de44c7d0ae
BLAKE2b-256 checksum
How to use checksums
7b8d3d964658604ce00e9cb7526dd2ceabdd5dc2001fd1f3a80b64ea117cc891
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 16, 2026.

Transparency log

Release files / mysql_shell_client-2.0.0-py3-none-any.whl

Download URL mysql_shell_client-2.0.0-py3-none-any.whl
Size 30.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad81e6b75719ab900f6d09aeb8bc675ee514322e080227f05f4c4dd8b56d6cef
BLAKE2b-256 checksum
How to use checksums
4eb86a0e63dec8c0ca6afe31d8bba8538c4bc4214cd5b6a6c8bf4434c25cc89c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.9.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page