Metadata-Version: 2.4
Name: pymydb-client
Version: 0.1.0
Summary: Pure-Python client for the MyDB database engine (mydbd)
Home-page: https://github.com/Hasnat056/pymydb-client
Author: Hasnat Akram
License: MIT
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Database
Requires-Python: >=2.7
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# pymydb-client

Pure-Python client for [MyDB](https://github.com/Hasnat056/MyDB-Database-Engine),
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

```bash
pip install pymydb-client
```

## Usage

```python
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:

```python
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](LICENSE).
