motedb-python 0.12.6__cp39-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.
motedb/__init__.py ADDED
@@ -0,0 +1,76 @@
1
+ """MoteDB — AI-native embedded multimodal database.
2
+
3
+ Rust-native engine (vectors / full-text / spatial / time-series in one ACID
4
+ store) with a Python-first surface. This wrapper adds Arrow/pandas interop
5
+ on top of the native extension.
6
+ """
7
+
8
+ from ._native import * # noqa: F401,F403
9
+ from ._native import Database as _Database
10
+
11
+ __version__ = __import__("_native_version_hack", fromlist=[""]) if False else None
12
+
13
+
14
+ def _native_version():
15
+ import motedb._native as _n
16
+
17
+ return getattr(_n, "__version__", "0.12.0")
18
+
19
+
20
+ __version__ = _native_version()
21
+
22
+
23
+ def query_arrow(self, sql, params=None):
24
+ """Run a SELECT and return a pyarrow.Table.
25
+
26
+ Columnar columns ride numpy (zero-copy where the engine already built
27
+ arrays); VECTOR columns become FixedSizeListArray(float32). Requires
28
+ pyarrow (`pip install pyarrow`).
29
+ """
30
+ import pyarrow as pa
31
+
32
+ cols, data = self.fetch_arrays(sql, params=params)
33
+ arrays = []
34
+ for c in cols:
35
+ v = data[c]
36
+ # VECTOR columns: 2D numpy (fast path) or a list of equal-length
37
+ # lists → FixedSizeListArray(float32), the canonical Arrow vector
38
+ # representation.
39
+ try:
40
+ import numpy as _np
41
+
42
+ if isinstance(v, _np.ndarray) and v.ndim == 2:
43
+ flat = _np.ascontiguousarray(v, dtype=_np.float32).reshape(-1)
44
+ arrays.append(
45
+ pa.FixedSizeListArray.from_arrays(pa.array(flat), v.shape[1])
46
+ )
47
+ continue
48
+ except ImportError:
49
+ pass
50
+ if isinstance(v, list) and v and isinstance(v[0], (list, tuple)):
51
+ dim = len(v[0])
52
+ if all(len(x) == dim for x in v):
53
+ flat = [f for row in v for f in row]
54
+ arrays.append(
55
+ pa.FixedSizeListArray.from_arrays(pa.array(flat, type=pa.float32()), dim)
56
+ )
57
+ continue
58
+ arrays.append(pa.array(v))
59
+ return pa.Table.from_arrays(arrays, names=list(cols))
60
+
61
+
62
+ def query_pandas(self, sql, params=None):
63
+ """Run a SELECT and return a pandas.DataFrame (via Arrow)."""
64
+ try:
65
+ import pandas as pd
66
+ except ImportError as e: # pragma: no cover
67
+ raise ImportError("query_pandas requires pandas (`pip install pandas`)") from e
68
+ return self.query_arrow(sql, params=params).to_pandas()
69
+
70
+
71
+ # Attach the interop methods to the pyo3 Database class (heap type — setattr
72
+ # on the class works; verified in test).
73
+ _Database.query_arrow = query_arrow
74
+ _Database.query_pandas = query_pandas
75
+
76
+ __all__ = [n for n in dir() if not n.startswith("_")]
motedb/_native.pyd ADDED
Binary file
@@ -0,0 +1,109 @@
1
+ Metadata-Version: 2.4
2
+ Name: motedb-python
3
+ Version: 0.12.6
4
+ Classifier: Development Status :: 4 - Beta
5
+ Classifier: Intended Audience :: Developers
6
+ Classifier: Intended Audience :: Science/Research
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: MacOS :: MacOS X
9
+ Classifier: Operating System :: POSIX :: Linux
10
+ Classifier: Programming Language :: Rust
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: Implementation :: CPython
18
+ Classifier: Topic :: Database
19
+ Classifier: Topic :: Database :: Database Engines/Servers
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ License-File: licenses/LICENSE
22
+ Summary: AI-native embedded multimodal database — SQL, vectors, full-text, spatial and time-series in one ACID engine, with edge presets for robots and edge devices.
23
+ Keywords: database,embedded-database,vector-search,full-text-search,spatial,time-series,rag,robotics,edge-ai,sql
24
+ License: MIT
25
+ Requires-Python: >=3.9
26
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
27
+ Project-URL: Changelog, https://github.com/motedb/motedb/blob/main/CHANGELOG.md
28
+ Project-URL: Documentation, https://github.com/motedb/motedb/tree/main/bindings/python
29
+ Project-URL: Homepage, https://github.com/motedb/motedb
30
+ Project-URL: Issues, https://github.com/motedb/motedb/issues
31
+ Project-URL: Repository, https://github.com/motedb/motedb
32
+ Project-URL: Source, https://github.com/motedb/motedb
33
+
34
+ # MoteDB Python Bindings
35
+
36
+ Embedded multimodal database for Python — SQL + vector search + full-text
37
+ search + spatial in one engine, with edge-presets for memory-constrained
38
+ devices.
39
+
40
+ ## Install (from source)
41
+
42
+ ```bash
43
+ pip install maturin
44
+ cd bindings/python
45
+ maturin develop --release
46
+ # no maturin / offline? scripts/build_wheel.sh builds a wheel with cargo+zip
47
+ ```
48
+
49
+ ## Quick start
50
+
51
+ ```python
52
+ import motedb
53
+
54
+ db = motedb.Database("/data/store.mote", preset="edge") # general|edge|robotics|embodied
55
+ db.execute("CREATE TABLE IF NOT EXISTS docs (id INT PRIMARY KEY AUTO_INCREMENT, text TEXT, emb VECTOR(384))")
56
+ db.execute("INSERT INTO docs (text, emb) VALUES (?, ?)", params=["hello world", [0.1] * 384])
57
+
58
+ rows = db.execute("SELECT id, text FROM docs WHERE text MATCH AGAINST('hello')") # list[dict]
59
+ cols, tuples = db.query("SELECT id, text FROM docs") # (columns, list[tuple])
60
+
61
+ # Vector ANN — literal or parameter vectors both order correctly:
62
+ near = db.execute("SELECT id FROM docs ORDER BY emb <-> ? LIMIT 5", params=[[0.1] * 384])
63
+
64
+ tx = db.begin()
65
+ db.execute("UPDATE docs SET text = ? WHERE id = 1", params=["hi"])
66
+ db.rollback(tx) # or db.commit(tx)
67
+
68
+ db.checkpoint() # durability point
69
+ db.close()
70
+ ```
71
+
72
+ ## API
73
+
74
+ | Method | Notes |
75
+ |---|---|
76
+ | `Database(path, preset=None, create=True)` | create-or-open |
77
+ | `execute(sql, params=None)` | SELECT → `list[dict]`; DML → affected count; DDL → None |
78
+ | `query(sql, params=None)` | SELECT → `(columns, list[tuple])` |
79
+ | `executemany(sql, params)` | one INSERT per parameter set — single WAL fsync per batch |
80
+ | `begin()/commit(tx)/rollback(tx)` | transactions |
81
+ | `doctor()` | self-check → `{"verdict", "checks": [{name,status,detail}]}` |
82
+ | `checkpoint()/vacuum()/close()` | lifecycle |
83
+
84
+ Parameter types: `None/bool/int/float/str/list[float]` (→ embedding vector),
85
+ and geometry dicts for GEOMETRY columns:
86
+ `{"type": "Point3D", "x": 1.0, "y": -2.0, "z": 0.5}`,
87
+ `{"type": "Point", "x": 1.0, "y": -2.0}`,
88
+ `{"type": "LineString"|"Polygon", "points": [[x, y], ...]}`.
89
+ Result types: `None/bool/int/float/str/list[float]` (vector), timestamp as
90
+ int microseconds, geometry as the same dict shapes (tensor still renders as
91
+ a `<tensor>` tag).
92
+
93
+ ## Benchmark
94
+
95
+ `bench/bench_edge.py` — reproducible edge-workload comparison vs stdlib
96
+ SQLite (see `bench/README.md` for methodology and reference numbers: point
97
+ 2.9×, filter 3.7×, GROUP BY 9.8×, ANN 3.2×, RSS −12%; honest loss on batch
98
+ insert).
99
+
100
+ ## Publishing
101
+
102
+ Wheels for 4 targets are built by `.github/workflows/python-wheels.yml` on
103
+ tag push; PyPI publishing uses Trusted Publisher (register the repo at
104
+ pypi.org → no token secret needed).
105
+
106
+ ## Known gaps (pre-1.0)
107
+
108
+ - Tensor/Spatial/TextDoc values pass through as tags, not Python objects.
109
+
@@ -0,0 +1,7 @@
1
+ motedb/__init__.py,sha256=RdshS60ZfD_9c96Xp7aFL3sQ1zXJdiPgfFE9oS5iQOc,2665
2
+ motedb/_native.pyd,sha256=7oVUdCCG9THMnUZU6ahNDL6G9pc0i-55gIgpj6Sew7M,9453056
3
+ motedb_python-0.12.6.dist-info/METADATA,sha256=aSVcuuEdEEodA5f2t5fIZpfRzIceF-US52QR4UIYuWo,4601
4
+ motedb_python-0.12.6.dist-info/WHEEL,sha256=xe4_tbg8wYdeh4O7nLbnWckzIQtCR4nODDgwke_TKy8,95
5
+ motedb_python-0.12.6.dist-info/licenses/licenses/LICENSE,sha256=XfL-D6vY6IcKiBSg3yzflH9sPq7bSHrVxwVefuCR-YU,1084
6
+ motedb_python-0.12.6.dist-info/sboms/motedb-python.cyclonedx.json,sha256=-iCR13hwrv_Q3goKpdJno-cNZCkG8sCk-7F5kvZ-xcE,114572
7
+ motedb_python-0.12.6.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.15.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp39-abi3-win_amd64
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 motedb
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.