sqlrite 0.1.4__cp38-abi3-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
sqlrite/__init__.py
ADDED
sqlrite/sqlrite.pyd
ADDED
|
Binary file
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sqlrite
|
|
3
|
+
Version: 0.1.4
|
|
4
|
+
Classifier: Development Status :: 3 - Alpha
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Rust
|
|
14
|
+
Classifier: Topic :: Database
|
|
15
|
+
Classifier: Topic :: Database :: Database Engines/Servers
|
|
16
|
+
Summary: Python bindings for SQLRite — a small, embeddable SQLite clone written in Rust.
|
|
17
|
+
Keywords: database,sql,sqlite,embedded,rust
|
|
18
|
+
Author-email: Joao Henrique Machado Silva <joaoh82@gmail.com>
|
|
19
|
+
License: MIT
|
|
20
|
+
Requires-Python: >=3.8
|
|
21
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
22
|
+
Project-URL: Documentation, https://github.com/joaoh82/rust_sqlite/blob/main/docs/embedding.md
|
|
23
|
+
Project-URL: Homepage, https://github.com/joaoh82/rust_sqlite
|
|
24
|
+
Project-URL: Repository, https://github.com/joaoh82/rust_sqlite
|
|
25
|
+
|
|
26
|
+
# sqlrite (Python)
|
|
27
|
+
|
|
28
|
+
Python bindings for [SQLRite](https://github.com/joaoh82/rust_sqlite) — a small, embeddable SQLite clone written in Rust. Shape follows PEP 249 / the stdlib `sqlite3` module, so most callers can pick it up without reading the docs.
|
|
29
|
+
|
|
30
|
+
## Install
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# From PyPI (once Phase 6e's CI/CD release pipeline is live):
|
|
34
|
+
pip install sqlrite
|
|
35
|
+
|
|
36
|
+
# From source in a clone of the repo:
|
|
37
|
+
pip install maturin
|
|
38
|
+
cd sdk/python
|
|
39
|
+
maturin develop --release
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Quick tour
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
import sqlrite
|
|
46
|
+
|
|
47
|
+
# File-backed or in-memory (use `":memory:"` to match sqlite3 convention).
|
|
48
|
+
conn = sqlrite.connect("foo.sqlrite")
|
|
49
|
+
# conn = sqlrite.connect(":memory:")
|
|
50
|
+
|
|
51
|
+
cur = conn.cursor()
|
|
52
|
+
cur.execute("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, age INTEGER)")
|
|
53
|
+
cur.execute("INSERT INTO users (name, age) VALUES ('alice', 30)")
|
|
54
|
+
cur.execute("INSERT INTO users (name, age) VALUES ('bob', 25)")
|
|
55
|
+
|
|
56
|
+
cur.execute("SELECT id, name, age FROM users")
|
|
57
|
+
for row in cur:
|
|
58
|
+
print(row) # (1, 'alice', 30), then (2, 'bob', 25)
|
|
59
|
+
|
|
60
|
+
# Column metadata (PEP 249 `.description`):
|
|
61
|
+
for col in cur.description:
|
|
62
|
+
print(col[0]) # 'id', 'name', 'age'
|
|
63
|
+
|
|
64
|
+
conn.close()
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Transactions
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
with sqlrite.connect("foo.sqlrite") as conn:
|
|
71
|
+
cur = conn.cursor()
|
|
72
|
+
cur.execute("BEGIN")
|
|
73
|
+
cur.execute("INSERT INTO users (name) VALUES ('carol')")
|
|
74
|
+
if looks_good:
|
|
75
|
+
conn.commit()
|
|
76
|
+
else:
|
|
77
|
+
conn.rollback()
|
|
78
|
+
# The context manager automatically commits on clean exit
|
|
79
|
+
# and rolls back on exception, then closes the connection.
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Read-only access
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
conn = sqlrite.connect_read_only("foo.sqlrite")
|
|
86
|
+
# Any write raises sqlrite.SQLRiteError. Multiple read-only
|
|
87
|
+
# connections on the same file coexist (shared OS lock).
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## API surface
|
|
91
|
+
|
|
92
|
+
| Function / Method | Purpose |
|
|
93
|
+
|----------------------------------|--------------------------------------------------|
|
|
94
|
+
| `sqlrite.connect(db)` | Open or create a file-backed DB (or `:memory:`) |
|
|
95
|
+
| `sqlrite.connect_read_only(db)` | Open an existing file with a shared lock |
|
|
96
|
+
| `Connection.cursor()` | Returns a new `Cursor` |
|
|
97
|
+
| `Connection.execute(sql, ...)` | Shortcut for `cursor().execute(...)` |
|
|
98
|
+
| `Connection.commit()` / `.rollback()` | Close the current transaction |
|
|
99
|
+
| `Connection.close()` | Drop the connection (releases OS file lock) |
|
|
100
|
+
| `Connection.in_transaction` | `bool` — inside a `BEGIN … COMMIT/ROLLBACK` |
|
|
101
|
+
| `Connection.read_only` | `bool` — opened via `connect_read_only` |
|
|
102
|
+
| `Cursor.execute(sql, params=None)` | Run one statement |
|
|
103
|
+
| `Cursor.executemany(sql, seq)` | DB-API placeholder (params deferred) |
|
|
104
|
+
| `Cursor.executescript(sql)` | `;`-separated batch of statements |
|
|
105
|
+
| `Cursor.fetchone()` | Next row as a tuple, or `None` |
|
|
106
|
+
| `Cursor.fetchmany(size=None)` | Up to `size` more rows as a list of tuples |
|
|
107
|
+
| `Cursor.fetchall()` | All remaining rows |
|
|
108
|
+
| `Cursor.description` | PEP 249 7-tuples per column (name + Nones) |
|
|
109
|
+
| `Cursor.rowcount` | `-1` (not tracked yet — returns as PEP 249 says) |
|
|
110
|
+
| `iter(cursor)` | `for row in cursor: …` |
|
|
111
|
+
| `sqlrite.SQLRiteError` | All engine failures bubble up as this |
|
|
112
|
+
|
|
113
|
+
## Parameter binding
|
|
114
|
+
|
|
115
|
+
`execute(sql, params)` accepts `None` and empty tuples/lists for DB-API compatibility, but any *non-empty* `params` raises `TypeError` with a clear message — the underlying engine doesn't support prepared-statement parameter binding yet (deferred to Phase 5a.2). For now, inline values into the SQL (with manual escaping).
|
|
116
|
+
|
|
117
|
+
## Running the tests
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
maturin develop
|
|
121
|
+
python -m pytest tests/
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## How this ships
|
|
125
|
+
|
|
126
|
+
- PyO3 (`abi3-py38`) for the Rust-Python boundary — one wheel works on every CPython 3.8+ release, no per-version rebuild.
|
|
127
|
+
- maturin as the build backend, emitting standard `.whl` files that pip can install directly.
|
|
128
|
+
- Phase 6e lands GitHub Actions that publish wheels to PyPI for manylinux x86_64/aarch64, macOS universal, and Windows x86_64 on every `v*` tag push.
|
|
129
|
+
|
|
130
|
+
## Status
|
|
131
|
+
|
|
132
|
+
Phase 5c MVP: ✅ — basic CRUD, transactions, context managers, read-only mode, iteration. Parameter binding, CursorRow namedtuples, and type converters (datetime, Decimal) are natural follow-ups.
|
|
133
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
sqlrite/__init__.py,sha256=VmexnaYoIFP5jCGF0OEGWFm87LqY1095eh1b7tKWoRY,111
|
|
2
|
+
sqlrite/sqlrite.pyd,sha256=ypCzrPK47c9BpDAw4RcfeIPjr2lhxE8F2y6DxkP7cnU,9932800
|
|
3
|
+
sqlrite-0.1.4.dist-info/METADATA,sha256=PhG93WrwFYeg5k3Nh4wASPBvhqFdjkug3Uifc0ksgvE,5780
|
|
4
|
+
sqlrite-0.1.4.dist-info/WHEEL,sha256=X8vvqavrCCzME4tEQB46rFZlEGXF4kNwLeRqgaDmIw4,95
|
|
5
|
+
sqlrite-0.1.4.dist-info/sboms/sqlrite-python.cyclonedx.json,sha256=Uy3nxDUKxJwcgvzNdfm7l58-LE4WhcP5Naq0qyNPbsM,97512
|
|
6
|
+
sqlrite-0.1.4.dist-info/RECORD,,
|