You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add Table.from_records and Table.from_file factory methods
Add two factory classmethods to Table for convenient initialization:
- Table.from_records(path, records, key): Create a table with initial
records. Validates all records before writing, writes atomically with
a header, and provides indexed error messages for debugging.
- Table.from_file(path, key=None): Load an existing file with automatic
key detection from the header. Raises FileError if file doesn't exist.
Update README quick start and examples to use the new factory methods.
|`Table.from_records(path, records, key)`| Create table with records |
158
+
|`Table.from_file(path)`| Load existing table |
159
+
|`get(key)`| Get a record by key, or `None`|
160
+
|`has(key)`| Check if a key exists |
161
+
|`put(record)`| Insert or update a record |
162
+
|`delete(key)`| Delete a record |
163
+
|`all()`| Iterate all records |
164
+
|`keys()`| Iterate all keys |
165
+
|`items()`| Iterate (key, record) pairs |
166
+
|`count()`| Number of records |
167
+
|`find(predicate, limit=None)`| Find matching records |
168
+
|`find_one(predicate)`| Find first match |
169
+
|`transaction()`| Start a transaction |
170
+
|`compact()`| Remove historical entries |
171
+
|`clear()`| Remove all records |
172
+
|`reload()`| Reload from disk |
156
173
157
174
The `Table` class also supports `len(table)`, `key in table`, and `for record in table`.
158
175
@@ -195,8 +212,6 @@ The JSONLT format draws from related work including [BEADS](https://github.com/s
195
212
196
213
The development of this library involved AI language models, specifically Claude (Anthropic). AI tools contributed to drafting code, tests, and documentation. Human authors made all design decisions and final implementations, and they reviewed, edited, and validated AI-generated content. The authors take full responsibility for the correctness of this software.
197
214
198
-
This disclosure promotes transparency about modern software development practices.
0 commit comments