Put the rows of a table's closed periods into packs: one note per period (`<table> <key>.md` in the
const url = 'https://example.com/datanotes/operations/pack_rows/';const options = { method: 'POST', headers: { 'X-Datanotes-Actor': '{"harness":"my-script","model":"","session":"s-1"}', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"table":"example","key":null,"dry_run":false}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/datanotes/operations/pack_rows/ \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'X-Datanotes-Actor: {"harness":"my-script","model":"","session":"s-1"}' \ --data '{ "table": "example", "key": null, "dry_run": false }'Put the rows of a table’s closed periods into packs: one note per period (<table> <key>.md in the
table’s folder), a ## section per row, key:: value lines for its values. The table needs a pack
option (create_table / alter_table, e.g. "{occurred_at:YYYY-MM}"). A period is closed
pack_after_days days after it ends (default 7); key packs only that period.
Nothing changes for the engine and its readers: select_rows, links, the graph and the change feed
still see each row at its path, with its values, text and file_modified (no change event, no new
version). Links from other notes to a packed row become [[pack#row]], which Obsidian follows too.
A row stays a note of its own (excluded, with the reason) when it changed in the last 24 hours, has a
# or ## heading in its text, is not at the path its values give, or its note is not in the form
the engine writes. The engine also packs on its own once a day (setting autoPack). Needs the engine
service. Journaled: undo_migration takes the rows out again. Use dry_run to see packs first.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”JSON: on whose behalf the write is made, recorded in the journal (harness, model, session).
Example
{"harness":"my-script","model":"","session":"s-1"}Request Bodyrequired
Section titled “Request Bodyrequired”Responses
Section titled “Responses”Done.
Result of a write operation. A refusal (ok false) is answered with HTTP 422, a failed write with 500, so a 2xx body has ok true.
object
True when the operation was applied (or, on a dry run, would be).
The operation, by the name it was called with (e.g. insert_row, create_table, recompute_columns).
True when nothing was written (preview).
Journal id of the applied operation: pass it to undo_migration. Absent on a dry run.
Notes whose front matter or body were written.
Files created.
Files moved or renamed.
Files deleted or archived.
Links rewritten in other notes.
Reasons the operation was refused (empty on success).
object
Note or file path.
Why the operation cannot proceed.
Rows that would break the table’s rules (empty on success).
The violations of one row.
object
Row note path.
What is wrong with this row.
object
The column the violation is about (every code but check and unreadable).
The item of a list column that breaks the rule, from 0.
The CHECK’s name (code check).
The CHECK’s own hint (code check), when the constraint has one: how to fix the row.
Kind of violation.
Agent-readable explanation.
The offending value, when there is one.
Files that could not be written (empty on success).
object
Vault path.
What went wrong.
Set when a write failed partway (failed): true when the engine put back what it had written, so nothing is left written; false when that rollback failed too (failed names the files left, and undo_migration on migration_id retries it).
Front matter edits per note (planned, or made).
object
Note path.
Front matter keys set, with their new values.
object
Front matter keys removed.
True when the note body changes too.
Paths of notes created.
Files moved: from → to.
object
Paths deleted (or archived).
Files rewritten whole, e.g. metastore.yaml for DDL.
Transaction-log commits written (tables with history on).
object
Qualified table.
New log version.
Log operation, e.g. WRITE.
Links the write added to the text it wrote: the notes the text mentions by name (automatic links). Present when there is one.
A link the write added in place of a mention.
object
The note the link was written into.
The mention, as written.
Vault path of the note it links.
The link written in place of the mention.
Mentions left as text because the engine is not sure which note they name. Present when there is one: read the candidates and the context, then link the right one with update_row and autolink: false, or leave the text.
A mention left as text: more than one note could be meant.
object
The note the mention is in.
The mention, as written.
Same_name: several notes have this name; adjacent: names of different notes side by side, which may be one name; overlap: names of notes overlap; part_of_name: a capitalized word next to it suggests a longer name; sentence_start: a one-word name at the start of a sentence, a line, a list item or a label, where its capital says nothing.
Vault paths of the notes it may name.
The line around the mention.
What to do: read the candidates, then link the right one with update_row and autolink: false, or leave the text.
Alter_table that moves or renames a table: the references to it in other definitions that it rewrites (on a dry run, would rewrite): the ref and vocabulary of the columns of other tables and of bases, and the tables the views’ queries read. Present when there is one.
A name of the moved table in another definition, rewritten to the new name.
object
The table whose column names it (full name).
The base whose column names it.
The view whose query names it (full name).
The column of the table or base.
Where the name is: ref or vocabulary of the column, or table, union[N].table or join.table of the view’s query.
The name as written before.
The name written in its place.
The packs written (or, on a dry run, to write): each pack’s file, its key and the rows that go in or come out.
object
The pack’s file.
The period of its rows, as the table’s pack option writes it.
The rows’ paths (each keeps its path in a pack).
Pack_rows: rows of closed periods that stay notes of their own, with the reason (changed in the last 24 hours, a # or ## heading in their text, not where their values put them, another YAML style).
object
Pack_rows: rows whose period is not over yet (or ended less than pack_after_days ago): not listed.
What is unwise in a table’s layout, though allowed: a partition wider than the periods of the table’s packs (create_table, alter_table; check_table lists them for the tables it checks). Present when there is one.
object
Kind of warning.
The table, catalog.schema.table.
What is unwise, and why.
How to fix it.
Where to read more (a Markdown page of the docs, with its anchor).
Example
{ "violations": [ { "violations": [ { "code": "required" } ] } ], "ambiguous_mentions": [ { "reason": "same_name" } ], "warnings": [ { "code": "pack_partition" } ]}Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type.
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}Missing or wrong bearer token.
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}A named token beyond its permissions (the engine’s administration, tables outside its write patterns, schema changes without ddl).
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}Unknown table, view, migration, note or folder.
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}Ambiguous table name: it matches several tables (paths or tables lists them).
object
The tables’ folders the name matches.
The qualified tables the name matches.
Example generated
{ "error": "example", "paths": [ "example" ], "tables": [ "example" ]}Unexpected error.
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}