Metadata-Version: 2.4
Name: pendb
Version: 0.1.2
Summary: A tiny shortcut wrapper around Python's sqlite3 module
Author-email: Antu <your-email@example.com>
License: MIT
Project-URL: Homepage, https://github.com/your-username/pendb
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# pendb

A tiny shortcut wrapper around Python's `sqlite3` module — no more manual
connection/cursor/commit boilerplate.

## Install

```bash
pip install pendb
```

## Usage

```python
from pendb import DB, it, tx

db = DB("shop.db")

db.ct("products", it("id").lock(), tx("name").lock())

db.inst("products", id=1, name="Rice")
db.inst("products", id=2, name="Oil")

print(db.select("products"))
print(db.select("products", where="name = 'Rice'"))

db.updt("products", "id = 1", name="Basmati Rice")
db.dlt("products", "id = 2")

db.close()
```

### Filtering, sorting, limiting (v0.2)

`where` takes a condition string, or a list of condition strings (ANDed together).
Operators: `=`, `>`, `<`, `>=`, `<=`, `!=`, `~` (LIKE / contains).

```python
db.select("products", where="price > 50")
db.select("products", where="price <= 100")
db.select("products", where="name != 'Oil'")
db.select("products", where="name ~ Ric")            # LIKE '%Ric%'
db.select("products", where=["price >= 10", "price <= 100"])  # AND

db.select("products", order="price")     # ascending
db.select("products", order="-price")    # descending

db.select("products", limit=5)           # first 5 rows
```

## API

| Method | SQL equivalent |
|---|---|
| `db.ct(table, *columns)` | `CREATE TABLE` |
| `db.inst(table, **values)` | `INSERT` |
| `db.select(table, where=None, order=None, limit=None)` | `SELECT` |
| `db.updt(table, where, **values)` | `UPDATE` |
| `db.dlt(table, where)` | `DELETE` |
| `db.drp(table)` | `DROP TABLE` |

Columns: `it("name")` for INTEGER, `tx("name")` for TEXT.
Chain `.lock()` for NOT NULL, `.unq()` for UNIQUE.

`where` accepts a condition string or list of strings, e.g. `"age >= 18"`.

Full method-by-method reference with more examples: [API_REFERENCE.md](API_REFERENCE.md)
