Skip to main content

Pure-Python client for the MyDB database engine (mydbd)

Project description

pymydb-client

Pure-Python client for MyDB, a relational database engine with a custom binary wire protocol served by its mydbd daemon. No third-party dependencies (just socket, hashlib, struct, getpass from the standard library); compatible with Python 2.7 through 3.x.

It reimplements the same challenge-response auth and framing the C mydb CLI uses, so it can talk to mydbd over either a Unix domain socket or TCP.

Install

pip install pymydb-client

Usage

from pymydb_client import connect

# Over TCP (mydbd's default TCP listener, 0.0.0.0:4442)
conn = connect(host="127.0.0.1", port=4442, user="root", password="yourpass")


print(conn.query("SHOW DATABASES;"))
conn.close()

Context manager form:

with connect(host="127.0.0.1", port=4442, user="root", password="yourpass") as conn:
    print(conn.query("SELECT id, name FROM users;"))

query(sql) returns the same formatted text a SQL client would print (a table for SELECT, or an OK/error message) — the wire protocol carries plain text, not structured rows.

Omit password to be prompted interactively via getpass. Connect/auth/query failures raise pymydb_client.MyDBError.

License

MIT — see LICENSE.

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

pymydb_client-0.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

pymydb_client-0.1.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pymydb_client-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for pymydb_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 759617860ff4c2eca99bc8060589d4958c18903c4916fc7f5fb3e108cdcb96ef
MD5 3cc4ee6580aefeed22d60134f3633fe5
BLAKE2b-256 47a255c10056a863a172cb1f7d4fc7f6645c144f2bac516c3dc7c7326b805b55

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymydb_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for pymydb_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c9ddf9ae8d7cd0cae51818e7e73f8552355652dee2dc197f1e2202624aac84d9
MD5 1c7bfd342f29914b492a47cfd0a836a6
BLAKE2b-256 ab274e0f7db21fe907452871afda813bbefd44044ff1760df140a9d66c3e9ba4

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