nabedra 0.1.0__tar.gz
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.
- nabedra-0.1.0/LICENSE +21 -0
- nabedra-0.1.0/PKG-INFO +374 -0
- nabedra-0.1.0/README.md +351 -0
- nabedra-0.1.0/pyproject.toml +38 -0
- nabedra-0.1.0/setup.cfg +4 -0
- nabedra-0.1.0/src/nabedra/__init__.py +36 -0
- nabedra-0.1.0/src/nabedra/__main__.py +4 -0
- nabedra-0.1.0/src/nabedra/_binary.py +56 -0
- nabedra-0.1.0/src/nabedra/_callback_bridge.py +233 -0
- nabedra-0.1.0/src/nabedra/_callback_pool.py +205 -0
- nabedra-0.1.0/src/nabedra/_callback_protocol.py +399 -0
- nabedra-0.1.0/src/nabedra/_cli_config.py +195 -0
- nabedra-0.1.0/src/nabedra/_cli_supervise.py +129 -0
- nabedra-0.1.0/src/nabedra/_control_transport.py +291 -0
- nabedra-0.1.0/src/nabedra/_serve_args.py +82 -0
- nabedra-0.1.0/src/nabedra/_serve_guard.py +126 -0
- nabedra-0.1.0/src/nabedra/_serve_process.py +507 -0
- nabedra-0.1.0/src/nabedra/aws.py +62 -0
- nabedra-0.1.0/src/nabedra/cli.py +281 -0
- nabedra-0.1.0/src/nabedra/client.py +482 -0
- nabedra-0.1.0/src/nabedra/cluster.py +303 -0
- nabedra-0.1.0/src/nabedra/errors.py +76 -0
- nabedra-0.1.0/src/nabedra/expr.py +106 -0
- nabedra-0.1.0/src/nabedra/gateway.py +459 -0
- nabedra-0.1.0/src/nabedra/gateway_protocol.py +162 -0
- nabedra-0.1.0/src/nabedra/providers.py +344 -0
- nabedra-0.1.0/src/nabedra/query.py +138 -0
- nabedra-0.1.0/src/nabedra/serve.py +54 -0
- nabedra-0.1.0/src/nabedra/table.py +143 -0
- nabedra-0.1.0/src/nabedra/validation.py +116 -0
- nabedra-0.1.0/src/nabedra.egg-info/PKG-INFO +374 -0
- nabedra-0.1.0/src/nabedra.egg-info/SOURCES.txt +61 -0
- nabedra-0.1.0/src/nabedra.egg-info/dependency_links.txt +1 -0
- nabedra-0.1.0/src/nabedra.egg-info/entry_points.txt +2 -0
- nabedra-0.1.0/src/nabedra.egg-info/requires.txt +8 -0
- nabedra-0.1.0/src/nabedra.egg-info/top_level.txt +1 -0
- nabedra-0.1.0/tests/test_aws.py +90 -0
- nabedra-0.1.0/tests/test_callback_bridge.py +410 -0
- nabedra-0.1.0/tests/test_callback_pool.py +384 -0
- nabedra-0.1.0/tests/test_callback_protocol.py +343 -0
- nabedra-0.1.0/tests/test_cli.py +150 -0
- nabedra-0.1.0/tests/test_cli_management.py +125 -0
- nabedra-0.1.0/tests/test_cli_supervision.py +148 -0
- nabedra-0.1.0/tests/test_client_api.py +173 -0
- nabedra-0.1.0/tests/test_cluster.py +221 -0
- nabedra-0.1.0/tests/test_cluster_wait.py +238 -0
- nabedra-0.1.0/tests/test_control_tls.py +181 -0
- nabedra-0.1.0/tests/test_control_transport.py +220 -0
- nabedra-0.1.0/tests/test_gateway.py +300 -0
- nabedra-0.1.0/tests/test_gateway_host.py +87 -0
- nabedra-0.1.0/tests/test_install_nabedra.py +58 -0
- nabedra-0.1.0/tests/test_providers.py +286 -0
- nabedra-0.1.0/tests/test_public_package.py +97 -0
- nabedra-0.1.0/tests/test_query.py +121 -0
- nabedra-0.1.0/tests/test_receipts.py +168 -0
- nabedra-0.1.0/tests/test_serve_args.py +130 -0
- nabedra-0.1.0/tests/test_serve_exit.py +265 -0
- nabedra-0.1.0/tests/test_serve_guard.py +195 -0
- nabedra-0.1.0/tests/test_serve_process.py +256 -0
- nabedra-0.1.0/tests/test_serve_public.py +53 -0
- nabedra-0.1.0/tests/test_table.py +193 -0
- nabedra-0.1.0/tests/test_transport.py +235 -0
- nabedra-0.1.0/tests/test_validation.py +88 -0
nabedra-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nabedra Database contributors
|
|
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.
|
nabedra-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nabedra
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Pure Python client for the Nabedra Database HTTP API
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Repository, https://github.com/zPy52/nabedra-database
|
|
7
|
+
Project-URL: Documentation, https://github.com/zPy52/nabedra-database/blob/main/orm/README.md
|
|
8
|
+
Project-URL: Issues, https://github.com/zPy52/nabedra-database/issues
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Topic :: Database
|
|
14
|
+
Requires-Python: >=3.11
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Provides-Extra: database
|
|
18
|
+
Provides-Extra: gateway
|
|
19
|
+
Requires-Dist: httpx<1,>=0.27; extra == "gateway"
|
|
20
|
+
Provides-Extra: aws
|
|
21
|
+
Requires-Dist: boto3<2,>=1.34; extra == "aws"
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# Nabedra Database Python ORM
|
|
25
|
+
|
|
26
|
+
Nabedra Database's synchronous Python client creates tables, reads and writes rows, and
|
|
27
|
+
builds queries for a separately running Nabedra Database v0 server. It requires Python
|
|
28
|
+
3.11+ and has no runtime dependencies beyond the standard library. The client
|
|
29
|
+
does not start the server or need AWS credentials; the server owns S3 access.
|
|
30
|
+
|
|
31
|
+
For shared compute, point this client at your application's endpoint. The
|
|
32
|
+
[framework-independent gateway](https://github.com/zPy52/nabedra-database/blob/main/docs/cli-and-serverless.md#host-an-application-endpoint)
|
|
33
|
+
lets that endpoint authorize and forward the existing operation with storage
|
|
34
|
+
credentials supplied by server middleware.
|
|
35
|
+
|
|
36
|
+
## Install and connect
|
|
37
|
+
|
|
38
|
+
Install from PyPI with Python 3.11+:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
python3.11 -m pip install "nabedra[database]"
|
|
42
|
+
export NABEDRA_TOKEN='<same-token-configured-on-your-server>'
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The distribution is named `nabedra`; Python imports also use `nabedra`.
|
|
46
|
+
The `database` extra adds no dependencies because the ORM uses the standard
|
|
47
|
+
library. `pip install nabedra` includes the same ORM and CLI. Optional
|
|
48
|
+
`nabedra[gateway]` and `nabedra[aws]` installs add HTTPX and Boto3 respectively;
|
|
49
|
+
use `nabedra[database,gateway,aws]` when you need both integrations.
|
|
50
|
+
|
|
51
|
+
The Python package does not bundle the Rust server. To run a server locally,
|
|
52
|
+
install the published crate separately with Cargo:
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
cargo install nabedra-database --version 0.1.0 --locked
|
|
56
|
+
nabedra-database-server --version
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
For development, run `python3.11 -m pip install -e ./orm` from the repository
|
|
60
|
+
root instead of installing from PyPI.
|
|
61
|
+
|
|
62
|
+
Replace the token placeholder in your environment. The example below assumes
|
|
63
|
+
the server is already listening at `http://127.0.0.1:8000`. Use its actual base
|
|
64
|
+
URL if different. Start with an unused table name; creating an existing name
|
|
65
|
+
raises `ConflictError`.
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from nabedra import Database, col
|
|
69
|
+
|
|
70
|
+
db = Database(url="http://127.0.0.1:8000", mode="olap")
|
|
71
|
+
users = db.create_table(
|
|
72
|
+
"guide_users", {"id": str, "age": int, "active": bool}, key="id"
|
|
73
|
+
)
|
|
74
|
+
users.insert({"id": "alice", "age": 24, "active": True})
|
|
75
|
+
inserted = users.insert_many(
|
|
76
|
+
{"id": name, "age": age, "active": True}
|
|
77
|
+
for name, age in [("bob", 17), ("carol", 30)]
|
|
78
|
+
) # 2
|
|
79
|
+
alice = users.get("alice") # complete row, or None if missing
|
|
80
|
+
updated = users.update("alice", {"age": 25}) # True
|
|
81
|
+
users.upsert({"id": "carol", "age": 31, "active": False})
|
|
82
|
+
|
|
83
|
+
adults = users.where(
|
|
84
|
+
(col("age") >= 18) & ((col("active") == True) | ~(col("id") == "carol"))
|
|
85
|
+
)
|
|
86
|
+
query = adults.select("id", "age").order_by("age", desc=True).limit(100)
|
|
87
|
+
rows = query.collect() # [{"id": "alice", "age": 25}]
|
|
88
|
+
count = query.count() # 1, including the limit
|
|
89
|
+
plan = query.explain() # textual plan from metadata, without a row scan
|
|
90
|
+
|
|
91
|
+
same_table = db.table("guide_users") # discover by name, retaining its ID
|
|
92
|
+
tables = db.tables() # handles sorted by name
|
|
93
|
+
deleted = users.delete("bob") # True; a second delete returns False
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`Database(url, token=None, *, mode="oltp", timeout=30.0, ca_file=None, database=None)` validates configuration
|
|
97
|
+
without sending a request. Supply an absolute HTTP or HTTPS base URL without
|
|
98
|
+
embedded credentials, query or fragment. The client appends `/v1/operations` to
|
|
99
|
+
its base path. If omitted, `token` comes from `NABEDRA_TOKEN`. Construction is
|
|
100
|
+
allowed without a token, but an operation raises `AuthenticationError` locally
|
|
101
|
+
until credentials are supplied through a new client. An explicit token must be
|
|
102
|
+
a nonempty safe bearer token string.
|
|
103
|
+
|
|
104
|
+
`mode` accepts `"olap"` and `"oltp"` and defaults to `"oltp"`. The read-only
|
|
105
|
+
`db.mode` property records this workload preference. Both modes currently use
|
|
106
|
+
the same server API and execution engine. `DB` remains a convenience alias for
|
|
107
|
+
`Database` within `nabedra`.
|
|
108
|
+
An optional `database` selector accompanies operations and receipt polling.
|
|
109
|
+
The application gateway treats it as untrusted input and authorizes access;
|
|
110
|
+
the selector itself grants no storage permissions.
|
|
111
|
+
|
|
112
|
+
HTTPS verifies certificates and hostnames using the system trust roots. For a
|
|
113
|
+
private CA, supply an additional PEM CA file:
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
import os
|
|
117
|
+
from nabedra import Database
|
|
118
|
+
|
|
119
|
+
db = Database(
|
|
120
|
+
url="https://nabedra.example.com",
|
|
121
|
+
token=os.environ["NABEDRA_TOKEN"],
|
|
122
|
+
mode="oltp",
|
|
123
|
+
timeout=10.0,
|
|
124
|
+
ca_file="/path/to/nabedra-ca.pem",
|
|
125
|
+
)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
`ca_file` adds trust roots and does not disable verification. It defaults to
|
|
129
|
+
`None`. `timeout` accepts a positive finite `int` or `float`, excluding `bool`,
|
|
130
|
+
and defaults to 30 seconds. It applies to blocking socket I/O, not a whole
|
|
131
|
+
operation deadline, cancellation or a server transaction deadline. The client
|
|
132
|
+
follows no redirects and performs no automatic retries.
|
|
133
|
+
|
|
134
|
+
## Command line
|
|
135
|
+
|
|
136
|
+
The installed console command groups database administration under `database`:
|
|
137
|
+
|
|
138
|
+
```sh
|
|
139
|
+
nabedra database init --help
|
|
140
|
+
nabedra database serve --config nabedra-database.json
|
|
141
|
+
nabedra database doctor --config nabedra-database.json
|
|
142
|
+
nabedra database cluster --help
|
|
143
|
+
nabedra database migrate --help
|
|
144
|
+
nabedra --version
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
`python -m nabedra database <command>` uses the same command parser.
|
|
148
|
+
|
|
149
|
+
The CLI uses `Nabedra` as the persisted cluster identifier for new clusters.
|
|
150
|
+
To attach to a cluster created by the earlier CLI, preserve its existing name
|
|
151
|
+
with `nabedra database serve --config nabedra-database.json --cluster-name MeshDB`.
|
|
152
|
+
Use `--cluster-name` for any other existing identifier too. Names must match
|
|
153
|
+
`[A-Za-z_][A-Za-z0-9_]{0,63}`. This flag selects the expected durable identity;
|
|
154
|
+
it does not rename or migrate stored cluster records. Keep the existing cluster
|
|
155
|
+
ID, credentials, storage and compatible configuration when attaching.
|
|
156
|
+
|
|
157
|
+
Kubernetes provider upgrades retain infrastructure ownership. New launches use
|
|
158
|
+
`nabedra.io/*` labels and `nabedra-<launch>` resource names. The provider also
|
|
159
|
+
reads existing `meshdb.io/*` labels, lifecycle annotations and
|
|
160
|
+
`meshdb-<launch>` resource names so running workers remain in inventory.
|
|
161
|
+
Retries reconcile the original launch, and deletion still requires its recorded
|
|
162
|
+
Pod UID. Mixed identity namespaces and duplicate launch identities fail rather
|
|
163
|
+
than report an empty inventory. Keep retained Secrets until the original workers
|
|
164
|
+
have completed their lifecycle.
|
|
165
|
+
|
|
166
|
+
## Tables and rows
|
|
167
|
+
|
|
168
|
+
Table and column names must match `[A-Za-z_][A-Za-z0-9_]{0,63}`. A schema has
|
|
169
|
+
1 to 128 columns and accepts exactly these Python types:
|
|
170
|
+
|
|
171
|
+
| Python type | Stored type | Accepted values |
|
|
172
|
+
| --- | --- | --- |
|
|
173
|
+
| `str` | UTF-8 string | Exact `str` values |
|
|
174
|
+
| `int` | Signed int64 | Integers from `-(2**63)` through `2**63 - 1` |
|
|
175
|
+
| `float` | Float64 | Finite floats; no NaN or infinity |
|
|
176
|
+
| `bool` | Boolean | Exact `True` or `False` |
|
|
177
|
+
|
|
178
|
+
Values must have the exact declared type. A boolean is not an integer here,
|
|
179
|
+
an integer does not fill a float column, and subclasses are not accepted.
|
|
180
|
+
Columns are nonnullable. Full rows must contain every schema column, with no
|
|
181
|
+
unknown columns or `None` values. The primary key must name a `str` or `int`
|
|
182
|
+
column and must be unique. Only `format="parquet"` is supported.
|
|
183
|
+
|
|
184
|
+
Obtain `Table` handles through `Database`, rather than constructing them directly.
|
|
185
|
+
Each handle has immutable `id`, `name`, `key` and `format` metadata and retains
|
|
186
|
+
its original schema. Input mappings are copied, and each access to
|
|
187
|
+
`table.schema` returns a fresh dictionary. Changing that dictionary does not
|
|
188
|
+
change the handle or server schema. Row and query operations use the table ID.
|
|
189
|
+
|
|
190
|
+
| Method | Result and behavior |
|
|
191
|
+
| --- | --- |
|
|
192
|
+
| `db.create_table(name, schema, key, *, format="parquet")` | New `Table`; an existing name raises `ConflictError`. |
|
|
193
|
+
| `db.table(name)` | One discovered `Table`; a missing name raises `NotFoundError`. |
|
|
194
|
+
| `db.tables()` | `list[Table]` sorted by name; `[]` if none exist. |
|
|
195
|
+
| `table.insert(row)` | `None`; an existing key raises `ConflictError`. |
|
|
196
|
+
| `table.insert_many(rows)` | Inserted `int` count from one atomic request. |
|
|
197
|
+
| `table.get(key)` | Complete row dictionary, or `None` for a missing row. |
|
|
198
|
+
| `table.update(key, values)` | `bool` indicating whether the row exists; accepts partial values, including `{}`, but forbids the key field even if unchanged. |
|
|
199
|
+
| `table.upsert(row)` | `None`; inserts a new row or replaces the entire existing row. |
|
|
200
|
+
| `table.delete(key)` | `True` if deleted, `False` for a missing row. |
|
|
201
|
+
| `table.query()` | New unfiltered `Query`, without network I/O. |
|
|
202
|
+
| `table.where(expr=None, **filters)` | New filtered `Query`, without network I/O. |
|
|
203
|
+
| `table.drop()` | `None`; removes the table from the server catalog. |
|
|
204
|
+
|
|
205
|
+
`insert_many` accepts an iterable, including a generator. It consumes and
|
|
206
|
+
validates one bounded batch before sending anything, stopping if it exceeds
|
|
207
|
+
10,000 rows or an 8 MiB encoded request. It never splits a batch or sends a
|
|
208
|
+
validated prefix. The server applies the whole batch atomically; duplicate keys
|
|
209
|
+
within the batch or against existing rows reject the batch. An empty iterable
|
|
210
|
+
still sends one request to validate table existence, then returns `0`.
|
|
211
|
+
|
|
212
|
+
Missing tables raise `NotFoundError`, including through old handles after a
|
|
213
|
+
drop. Recreating the same name gives a new ID; existing handles and their queries
|
|
214
|
+
remain stale. Obtain a new handle with `db.table(name)`. Dropping a table does
|
|
215
|
+
not delete retained S3 snapshots.
|
|
216
|
+
|
|
217
|
+
## Queries and expressions
|
|
218
|
+
|
|
219
|
+
Build scalar comparisons with `col(name)` and `==`, `!=`, `>`, `>=`, `<` or
|
|
220
|
+
`<=`. Boolean columns support only `==` and `!=`. Comparisons must use a scalar
|
|
221
|
+
of the column's exact type; column-to-column comparisons and callbacks are
|
|
222
|
+
unsupported. Combine complete comparisons with `&`, `|` and `~`, and put
|
|
223
|
+
parentheses around each comparison. Python `and`, `or`, `not` and chained
|
|
224
|
+
comparisons raise `TypeError` when they attempt to convert an expression to a
|
|
225
|
+
boolean. Predicate nesting is limited to 32 levels, including levels introduced
|
|
226
|
+
by repeated `where` calls.
|
|
227
|
+
|
|
228
|
+
Queries and expressions are immutable. Builders make no network requests and
|
|
229
|
+
return new queries, so a base query can be reused:
|
|
230
|
+
|
|
231
|
+
```python
|
|
232
|
+
base = users.where(active=True)
|
|
233
|
+
adults = base.where(col("age") >= 18)
|
|
234
|
+
youngest = adults.order_by("age").limit(5)
|
|
235
|
+
oldest = adults.order_by("age", desc=True).limit(5)
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Repeated `where(expr=None, **filters)` calls combine the existing predicate,
|
|
239
|
+
the expression and keyword equalities with AND. `where()` with no arguments
|
|
240
|
+
returns an equivalent query. Repeated `select`, `order_by` and `limit` calls
|
|
241
|
+
replace their respective settings.
|
|
242
|
+
|
|
243
|
+
| Query method | Result and behavior |
|
|
244
|
+
| --- | --- |
|
|
245
|
+
| `select(*columns)` | New query projecting nonempty, unique, existing columns. The key need not be selected. |
|
|
246
|
+
| `where(expr=None, **filters)` | New query with additional AND conditions. |
|
|
247
|
+
| `order_by(column, desc=False)` | New query ordering by one column; `desc` must be an exact `bool`. |
|
|
248
|
+
| `limit(n)` | New query with a nonnegative exact `int` limit; `bool` is invalid. |
|
|
249
|
+
| `collect()` | `list[Row]` containing exactly the selected columns, or all columns by default; `[]` for no matches. |
|
|
250
|
+
| `count()` | Integer count of matching rows after the explicit limit. |
|
|
251
|
+
| `explain()` | Textual plan using metadata only; no data scan or timing measurements. |
|
|
252
|
+
|
|
253
|
+
Each terminal call sends a fresh request. `collect` and `count` observe a fresh
|
|
254
|
+
committed snapshot each time; a query does not pin data across calls. The server
|
|
255
|
+
filters, orders, limits, then projects. Default ordering is primary-key ascending.
|
|
256
|
+
Explicit ordering always uses primary-key ascending to break ties, even for
|
|
257
|
+
descending order. `limit(0).collect()` returns `[]` and `limit(0).count()` returns
|
|
258
|
+
`0`. Projection does not change the count.
|
|
259
|
+
|
|
260
|
+
`collect()` may return at most 10,000 rows within an 8 MiB response. There is no
|
|
261
|
+
implicit limit or automatic truncation. The server returns `LimitExceededError`
|
|
262
|
+
for an oversized result; use an explicit smaller limit or projection. `count()`
|
|
263
|
+
returns a scalar and can count more than 10,000 matches. Pagination and streaming
|
|
264
|
+
results are not available in v0.
|
|
265
|
+
|
|
266
|
+
## Errors and uncertain writes
|
|
267
|
+
|
|
268
|
+
All client errors below derive from `NabedraError`, exported by `nabedra`.
|
|
269
|
+
|
|
270
|
+
| Exception | Meaning |
|
|
271
|
+
| --- | --- |
|
|
272
|
+
| `ValidationError` | Invalid local input or server validation failure. |
|
|
273
|
+
| `AuthenticationError` | Credentials are missing locally or the server rejected authentication. |
|
|
274
|
+
| `NotFoundError` | Table does not exist, including a stale table ID. |
|
|
275
|
+
| `ConflictError` | Duplicate table/key or a server commit conflict. |
|
|
276
|
+
| `LimitExceededError` | Local input or a valid server error exceeds a limit. |
|
|
277
|
+
| `OverloadedError` | Server cannot accept more work. |
|
|
278
|
+
| `StorageError` | Server storage failed with outcome `not_applied`. |
|
|
279
|
+
| `TransportError` | Read-side network failure. |
|
|
280
|
+
| `ProtocolError` | Malformed or invalid read response, including an oversized response. |
|
|
281
|
+
| `UnknownOutcomeError` | Mutation may have committed despite an unknown server outcome or a lost/invalid response. |
|
|
282
|
+
| `NabedraError` | Other valid server error. |
|
|
283
|
+
|
|
284
|
+
Errors expose `code`, `request_id`, `status_code` and `outcome`. Local errors may
|
|
285
|
+
have no request ID or HTTP status. Server errors preserve their diagnostics;
|
|
286
|
+
`outcome` can be `"not_applied"` or `"unknown"`, while some local/read failures
|
|
287
|
+
have `None`. A request UUID identifies one logical queued operation. Submitting the same UUID
|
|
288
|
+
and exact body attaches to that request; a different body conflicts. The client
|
|
289
|
+
does not automatically resubmit operations.
|
|
290
|
+
|
|
291
|
+
After `UnknownOutcomeError`, keep the original identity. A request can still
|
|
292
|
+
commit after its response disappears. Use its receipt or durable mutation
|
|
293
|
+
decision to reconcile the outcome before submitting another logical mutation.
|
|
294
|
+
|
|
295
|
+
## Queue receipts
|
|
296
|
+
|
|
297
|
+
Existing table/query methods remain synchronous. They submit through the same
|
|
298
|
+
worker queue as the receipt interface. Acceptance returns a queue identity and
|
|
299
|
+
does not mean a mutation has committed.
|
|
300
|
+
|
|
301
|
+
```python
|
|
302
|
+
from nabedra import Database
|
|
303
|
+
|
|
304
|
+
client = Database(url="http://127.0.0.1:8000", token="data-token", mode="olap")
|
|
305
|
+
receipt = client.submit("query.count", {
|
|
306
|
+
"table_id": table.id,
|
|
307
|
+
"query": {"select": None, "filter": None, "order_by": None, "limit": None},
|
|
308
|
+
})
|
|
309
|
+
print(receipt.run_id, receipt.request_id, receipt.state)
|
|
310
|
+
terminal = receipt.wait(timeout=30)
|
|
311
|
+
assert terminal.state == "succeeded", terminal.error
|
|
312
|
+
print(terminal.result)
|
|
313
|
+
|
|
314
|
+
# Reconnect through another API using the same database credentials.
|
|
315
|
+
receipt = client.receipt(receipt.run_id, receipt.request_id)
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
`RequestReceipt` has `request_id`, `run_id`, `state`, `result`, `error`, and the
|
|
319
|
+
`terminal` property. `poll()` returns a fresh receipt. `wait()` polls until a
|
|
320
|
+
terminal state or its deadline. A wait timeout releases the client transport and
|
|
321
|
+
does not cancel accepted work. To retry an uncertain submission, preserve the
|
|
322
|
+
original UUID and operation payload and pass `request_id=` to `submit()`.
|
|
323
|
+
|
|
324
|
+
Receipt states are `queued`, `running`, `committing`, `reconciling`, `succeeded`,
|
|
325
|
+
`failed`, and `abandoned`. Query results expire at the configured retention
|
|
326
|
+
interval and then return explicit `NotFoundError`. Durable mutation decisions
|
|
327
|
+
remain reconcilable after result expiration or a run change.
|
|
328
|
+
|
|
329
|
+
Every ready worker holds complete request records in RAM. An API restart or an
|
|
330
|
+
individual worker failure can recover accepted work from another holder. A
|
|
331
|
+
joining worker copies the queue before readiness. Stopping every worker abandons
|
|
332
|
+
outstanding requests. An explicit `--cold-start` fences prior attempts and starts
|
|
333
|
+
a new run without reconstructing pending requests from storage. Committed rows
|
|
334
|
+
and mutation decisions remain durable. A one-worker deployment has one queue
|
|
335
|
+
copy and cannot survive losing that process.
|
|
336
|
+
|
|
337
|
+
## Limits and scope
|
|
338
|
+
|
|
339
|
+
Requests and responses are capped at 8 MiB of encoded JSON, including envelopes.
|
|
340
|
+
Batches and collected results are capped at 10,000 rows, schemas at 128 columns,
|
|
341
|
+
and server tables at 100,000 rows and 64 MiB of decoded row payload. Byte limits
|
|
342
|
+
can be reached before row limits. The server remains authoritative for stored
|
|
343
|
+
data and commit validation.
|
|
344
|
+
|
|
345
|
+
The table/query methods remain synchronous; receipt submission and polling let
|
|
346
|
+
clients release their connections while work runs. Keyed operations route to one
|
|
347
|
+
primary-key-range partition, and changed mutations rewrite only affected files.
|
|
348
|
+
Queries scan partitions on persistent local OS worker threads and combine
|
|
349
|
+
results with global ordering, ascending-primary-key ties, limit, projection and
|
|
350
|
+
count semantics. Worker count is independent of partition count and can change
|
|
351
|
+
on restart. A fenced worker scheduler shares compute and memory across requests.
|
|
352
|
+
Mutation preparation produces private immutable files, then one conditional
|
|
353
|
+
catalog update publishes the full operation and its durable decision.
|
|
354
|
+
|
|
355
|
+
Partitions do not multiply the limits above. New closed Parquet files, including
|
|
356
|
+
metadata, have a 64 MiB hard cap of 67,108,864 bytes. A singleton may exceed a
|
|
357
|
+
smaller configured target but never the cap; an impossible file fails the whole
|
|
358
|
+
mutation. Empty tables have no files. A new target affects new or rewritten
|
|
359
|
+
ranges without repacking unchanged files. Version 1 remains readable; version 2
|
|
360
|
+
can mix Legacy and Partitioned tables. Only an actual data change migrates a
|
|
361
|
+
legacy table. The shared request runtime uses catalog format 4. Upgrading an
|
|
362
|
+
existing format 1/2/3 catalog requires `--migrate-catalog` after stopping every
|
|
363
|
+
old writer. Old binaries must remain stopped after migration.
|
|
364
|
+
Historical objects remain in S3 with no garbage collection.
|
|
365
|
+
|
|
366
|
+
The API provides no general transactions across calls, joins, import/export,
|
|
367
|
+
schema migrations, model decorators, relationships, indexes, or
|
|
368
|
+
data-frame adapters. The atomic batch remains a single operation.
|
|
369
|
+
|
|
370
|
+
See the [server guide](https://github.com/zPy52/nabedra-database/blob/main/server/README.md#configuration) for size syntax and
|
|
371
|
+
worker configuration, and the [partition workers rubric](https://github.com/zPy52/nabedra-database/blob/main/plans/partition-workers.md)
|
|
372
|
+
for current storage contracts. The [ORM contract](https://github.com/zPy52/nabedra-database/blob/main/plan-v0/orm.md) and
|
|
373
|
+
[server contract](https://github.com/zPy52/nabedra-database/blob/main/plan-v0/server.md) are historical v0 baselines; their
|
|
374
|
+
single-file storage and request-only worker descriptions predate partition workers.
|