Skip to content

Configure the database (persisted in metastore.yaml `config:`): `root` (rename the database

POST
/datanotes/operations/configure_database/
curl --request POST \
--url https://example.com/datanotes/operations/configure_database/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Datanotes-Actor: {"harness":"my-script","model":"","session":"s-1"}' \
--data '{ "root": null, "default_catalog": null, "default_schema": null, "default_partition": null, "default_filename": null, "archive_folder": null, "timezone": null, "history": null, "autolink": null }'

Configure the database (persisted in metastore.yaml config:): root (rename the database folder; links follow; revert by renaming back), default_catalog, default_schema, default_partition (“” = flat) and default_filename (date formats for new time-based tables), archive_folder, timezone (IANA; completes date-times written without offset), history (transaction log for every table: true in a database the engine creates, false when config lacks it, as in a metastore from before 3.0.0; change it only on the user’s request), autolink (the text a write puts in a body links the notes it mentions; on by default). Returns describe_database. Renaming root moves the folder (links to its notes are rewritten; the tables’ archive and exclude folders inside it follow); the move is listed in the journal as move_database (undo and time travel read older entries with the new paths) and cannot be undone. Settings changes are not journaled (no migration_id, nothing for undo_migration): to revert, call it again with the previous values.

The metastore changes only through operations: never edit metastore.yaml by hand (no validation).

X-Datanotes-Actor
string

JSON: on whose behalf the write is made, recorded in the journal (harness, model, session).

Example

{"harness":"my-script","model":"","session":"s-1"}
Media typeapplication/json
object
root
Any of:
string
default_catalog
Any of:
string
default_schema
Any of:
string
default_partition
Any of:
string
default_filename
Any of:
string
archive_folder
Any of:
string
timezone
Any of:
string
history
Any of:
boolean
autolink
Any of:
boolean

Done.

Media typeapplication/json
DatabaseDescription

The database: configuration, catalogs, schemas, tables, views and bases.

object
root
required

Database folder in the vault.

string
metastore
required

Path of metastore.yaml (catalogs, schemas, tables, views).

string
journal
required

Folder of the operation journal.

string
config
required

Database configuration.

object
default_catalog
required
string
default_schema
required
string
default_partition
required

Date format of row sub-folders; empty = flat.

string
default_filename
required

Date format of row file names.

string
archive_folder
required
string
timezone
required

IANA time zone; empty = values stored as given.

string
history
required

Transaction log (time travel) on by default.

boolean
autolink
required

Automatic links in the text writes put in bodies (on by default).

boolean
catalogs
required

Tables and views by catalog and schema.

Array<object>
object
catalog
required
string
description

What the catalog holds (comment_on).

string
default

Present (true) on the default catalog.

boolean
schemas
required
Array<object>
object
schema
required
string
description

What the schema holds (comment_on).

string
tables
required
Array<object>
object
name
required
string
qualified
required

Catalog.schema.table

string
row_count
required

Row count.

integer
unreadable_count

Rows whose front matter cannot be read, when there are any: not in row_count, since every read leaves them out. check_table lists them (code unreadable).

integer
description
string
tags

Key/value labels of the table, when it has any.

object
key
additional properties
string
missing_descriptions
MissingDescriptions

What has no description, when something has none (a table defined before descriptions were required): fill them with alter_table and alter_column.

object
table
required

True when the table itself has no description.

boolean
columns
required

The columns without a description.

Array<string>
views
required
Array<object>
object
name
required
string
qualified
required
string
description
string
bases
required

Bases (shared columns) and the tables that extend each one.

Array<object>
object
name
required
string
description
string
bases

The bases this base builds on, in order.

Array<string>
columns
required

Column names the base declares.

Array<string>
tables
required

Qualified tables extending it.

Array<string>
missing_descriptions

What has no description, when something has none (a base defined before descriptions were required): define_base fills them.

object
base
required

True when the base has no comment.

boolean
columns
required

The base’s columns without a description.

Array<string>

Example generated

{
"root": "example",
"metastore": "example",
"journal": "example",
"config": {
"default_catalog": "example",
"default_schema": "example",
"default_partition": "example",
"default_filename": "example",
"archive_folder": "example",
"timezone": "example",
"history": true,
"autolink": true
},
"catalogs": [
{
"catalog": "example",
"description": "example",
"default": true,
"schemas": [
{
"schema": "example",
"description": "example",
"tables": [
{
"name": "example",
"qualified": "example",
"row_count": 1,
"unreadable_count": 1,
"description": "example",
"tags": {
"additionalProperty": "example"
},
"missing_descriptions": {
"table": true,
"columns": [
"example"
]
}
}
],
"views": [
{
"name": "example",
"qualified": "example",
"description": "example"
}
]
}
]
}
],
"bases": [
{
"name": "example",
"description": "example",
"bases": [
"example"
],
"columns": [
"example"
],
"tables": [
"example"
],
"missing_descriptions": {
"base": true,
"columns": [
"example"
]
}
}
]
}

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 beyond its permissions (the engine’s administration, tables outside its write patterns, schema changes without ddl).

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}

Unexpected error.

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}