Skip to content

Validate every row against the table (required, types, ranges, enums, links, unknown

POST
/datanotes/operations/check_table/
curl --request POST \
--url https://example.com/datanotes/operations/check_table/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "table": null, "limit": 500, "offset": 0 }'

Validate every row against the table (required, types, ranges, enums, links, unknown columns, CHECK constraints, those that follow links included, filtered link targets (ref_where / ref_by), stale generated/identity values, missing inverse links, cycles of hierarchy and acyclic columns, front matter that cannot be read: code unreadable, with no column, for a note whose table line names the table but whose YAML is broken, which every other read leaves out). A CHECK violation has code check and the CHECK’s name as constraint (every other code names its column), as in the violations of list_changes. Use it to find rows edited by hand that break the schema. Without table, every table is checked: each row then names its table, tables_checked counts the tables checked, and a table that cannot be checked is listed in errors ({table, error}) while the others are. The rows with violations are paged: limit (default 500, at most 5000) from offset; total counts them all. (Hand edits are also checked as they happen: see violations in list_changes.) warnings lists what is unwise in a table’s layout, though allowed (pack_partition: a partition wider than the periods of its packs), each with a hint and a docs link.

X-Datanotes-View-As
string

Owner only, on reads only (an operation that only reads, tokens/me/, extensions/, the change stream): the request runs with this named token’s permissions and read scope, and the token’s last_seen does not change. A named token sending it gets 403; a request that is not a read gets 400.

Media typeapplication/json
object
table
Any of:
string
limit

Rows with violations returned (paging).

integer
default: 500 >= 1 <= 5000
offset

Rows with violations skipped first (paging).

integer
0

Done.

Media typeapplication/json
object
table
required

Qualified table; null when every table was checked.

string | null
rows_checked
required

Rows checked.

integer
tables_checked

Tables checked (when every table was checked).

integer
total
required

Rows breaking the rules in all (violations is the page from offset).

integer
errors

Tables that could not be checked (when every table was checked), with the reason.

Array<object>
object
table
required
string
error
required
string
violations
required

Rows breaking the table’s rules (this page of them).

Array<object>
CheckedRow

A row breaking the rules, with its table when every table was checked.

object
path
required

Row note path.

string
table

The row’s qualified table (when every table was checked).

string
violations
required

What is wrong with this row.

Array<object>
Violation
object
column

The column the violation is about (every code but check and unreadable).

string
index

The item of a list column that breaks the rule, from 0.

integer
constraint

The CHECK’s name (code check).

string
hint

The CHECK’s own hint (code check), when the constraint has one: how to fix the row.

string
code
required

Kind of violation.

string
Allowed values: required inverse type min max step enum broken_link ref unique unknown_column check generated cycle vocabulary unreadable
message
required

Agent-readable explanation.

string
value

The offending value, when there is one.

warnings

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.

Array<object>
object
code
required

Kind of warning.

string
Allowed values: pack_partition
table
required

The table, catalog.schema.table.

string
message
required

What is unwise, and why.

string
hint
required

How to fix it.

string
docs
required

Where to read more (a Markdown page of the docs, with its anchor).

string

Example

{
"violations": [
{
"violations": [
{
"code": "required"
}
]
}
],
"warnings": [
{
"code": "pack_partition"
}
]
}

Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type.

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}

Missing or wrong bearer token.

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}

A named token whose read patterns do not cover the table, view or note the request names (such as token cook may not read personal.health.weight). Sets it did not name (listings, bases, search, the graph, the change feed) are filtered instead.

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}

Unknown table, view, migration, note or folder.

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}

Ambiguous table name: it matches several tables (paths or tables lists them).

Media typeapplication/json
object
error
required
string
paths

The tables’ folders the name matches.

Array<string>
tables

The qualified tables the name matches.

Array<string>

Example generated

{
"error": "example",
"paths": [
"example"
],
"tables": [
"example"
]
}

Unexpected error.

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}