316 lines
18 KiB
HTML
316 lines
18 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
|
||
|
||
<meta charset="utf-8">
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
||
|
||
<link rel="canonical" href="https://git.tylconsulting.it/thothii-docs/operations/database-management/">
|
||
<link rel="shortcut icon" href="../../img/favicon.ico">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
||
<title>Databases and descriptions - ThothII Docs</title>
|
||
<link href="../../css/bootstrap-3.3.7.min.css" rel="stylesheet">
|
||
<link href="../../css/font-awesome-4.7.0.css" rel="stylesheet">
|
||
<link href="../../css/base.css" rel="stylesheet">
|
||
<link rel="stylesheet" href="../../css/highlight.css">
|
||
<link href="../../stylesheets/extra.css" rel="stylesheet">
|
||
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||
<!--[if lt IE 9]>
|
||
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
||
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
|
||
<![endif]-->
|
||
|
||
<script src="../../js/jquery-3.2.1.min.js"></script>
|
||
<script src="../../js/bootstrap-3.3.7.min.js"></script>
|
||
<script src="../../js/highlight.pack.js"></script>
|
||
|
||
<base target="_top">
|
||
<script>
|
||
var base_url = '../..';
|
||
var is_top_frame = false;
|
||
|
||
var pageToc = [
|
||
{title: "Database management", url: "#_top", children: [
|
||
{title: "What the catalog owns", url: "#what-the-catalog-owns" },
|
||
{title: "Navigate the Fleet Ledger surface", url: "#navigate-the-fleet-ledger-surface" },
|
||
{title: "Configure and test a database", url: "#configure-and-test-a-database" },
|
||
{title: "Synchronize authoritative schema metadata", url: "#synchronize-authoritative-schema-metadata" },
|
||
{title: "Generate and consolidate descriptions", url: "#generate-and-consolidate-descriptions" },
|
||
]},
|
||
];
|
||
|
||
</script>
|
||
<script src="../../js/base.js"></script>
|
||
<script src="../../javascripts/layout-init.js"></script>
|
||
</head>
|
||
|
||
<body>
|
||
<script>
|
||
if (is_top_frame) { $('body').addClass('wm-top-page'); }
|
||
</script>
|
||
|
||
|
||
|
||
<div class="container-fluid wm-page-content">
|
||
<a name="_top"></a>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div class="row wm-article-nav-buttons" role="navigation" aria-label="navigation">
|
||
|
||
<div class="wm-article-nav pull-right">
|
||
<a href="../sensitivity-analysis/" class="btn btn-xs btn-default pull-right">
|
||
Next
|
||
<i class="fa fa-chevron-right" aria-hidden="true"></i>
|
||
</a>
|
||
<a href="../sensitivity-analysis/" class="btn btn-xs btn-link">
|
||
Sensitive columns
|
||
</a>
|
||
</div>
|
||
|
||
<div class="wm-article-nav">
|
||
<a href="../workspaces/" class="btn btn-xs btn-default pull-left">
|
||
<i class="fa fa-chevron-left" aria-hidden="true"></i>
|
||
Previous</a><a href="../workspaces/" class="btn btn-xs btn-link">
|
||
Workspaces
|
||
</a>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
<h1 id="database-management">Database management<a class="headerlink" href="#database-management" title="Permanent link">¶</a></h1>
|
||
<p>Database Management is the administrative PostgreSQL Metadata Catalog for an external PostgreSQL
|
||
schema. Its binding and metadata are the sole database source used by workspace preprocessing and
|
||
the NL→SQL session workflow.</p>
|
||
<h2 id="what-the-catalog-owns">What the catalog owns<a class="headerlink" href="#what-the-catalog-owns" title="Permanent link">¶</a></h2>
|
||
<p>For each workspace identity, an administrator may configure at most one Metadata Catalog binding. It holds
|
||
the database name, schema, connection binding, write-only encrypted secrets, observed physical
|
||
schema, optional curated descriptions, generated descriptions, and durable operation history.</p>
|
||
<p>It does <strong>not</strong> become the external source of truth. Tables, columns, types, defaults,
|
||
nullability, primary-key positions, and ordered foreign-key pairs are observations of the source
|
||
schema and cannot be manually created, renamed, or structurally edited. Descriptions are the
|
||
editable metadata.</p>
|
||
<h2 id="navigate-the-fleet-ledger-surface">Navigate the Fleet Ledger surface<a class="headerlink" href="#navigate-the-fleet-ledger-surface" title="Permanent link">¶</a></h2>
|
||
<p>Database Management opens Fleet Ledger inside the normal application shell. Only one data grid is
|
||
shown at a time: choose a database to see its tables, choose a table to see its columns, or open the
|
||
database's relationships view. Use the emphasized back control or breadcrumb to return to the parent
|
||
grid.</p>
|
||
<p>The KPI strip reports tables, columns, sensitive columns, relationships, and description coverage.
|
||
It uses <code>GET /catalog/metrics</code> without <code>databaseId</code> for installation totals and with <code>databaseId</code> for
|
||
the current database. Choose a selection-scoped operation from the action selector and then press
|
||
<strong>Run</strong>; unavailable operations remain listed with an explanation. Row-specific actions are the icon
|
||
controls in the final column, and each navigation or action icon has an immediate conceptual tooltip.
|
||
An unconfigured workspace exposes <strong>Configure catalog</strong> directly on its row; there is no global
|
||
database-creation action and the selected workspace cannot be changed in the configuration form.</p>
|
||
<p>The master grid keeps three independent states visible:</p>
|
||
<ul>
|
||
<li><strong>Revision / Evidence</strong> comes from the active immutable workspace revision. Filesystem Evidence is
|
||
materialized with that revision; remote Evidence is reported as configured-but-unverified or as
|
||
requiring credentials.</li>
|
||
<li><strong>NL→SQL runtime</strong> is calculated from the workspace DWH/Evidence requirements and runtime secret
|
||
store. It also reports transports, such as SSH, that are diagnostic-only and unsupported by sessions.</li>
|
||
<li><strong>Metadata Catalog</strong> reports whether the installation-local catalog configuration exists, then shows
|
||
its separately versioned connection-test or synchronization state.</li>
|
||
</ul>
|
||
<p>Configuration, object details, metadata editors, synchronization history, description history,
|
||
sensitive-field review, and suggestion-run history open in right-side drawers backed by the
|
||
production catalog APIs.
|
||
Closing a history drawer does not cancel a durable background run. Existing permission checks,
|
||
dirty/busy navigation guards, stale-state handling, and write-only secret behavior continue to
|
||
apply.</p>
|
||
<p>For temporary comparison in development or staging, add <code>?db-ui=legacy</code>; the parameter is honored
|
||
only by Vite development or an environment explicitly configured with
|
||
<code>VITE_DB_MANAGEMENT_LEGACY=true</code>. The separate prototype on port <code>5173</code> is not the application and
|
||
remains available only until the integrated Fleet Ledger surface passes owner acceptance.</p>
|
||
<h2 id="configure-and-test-a-database">Configure and test a database<a class="headerlink" href="#configure-and-test-a-database" title="Permanent link">¶</a></h2>
|
||
<ol>
|
||
<li>Open <strong>Database Management</strong> and find the repository workspace marked <strong>Not configured</strong>.</li>
|
||
<li>Choose <strong>Configure catalog</strong> on that row. Configure its PostgreSQL catalog binding with
|
||
<code>postgres_direct</code>, <code>rest_api</code>, or <code>ssh_tunnel</code> and
|
||
complete the binding fields that the chosen transport requires.</li>
|
||
<li>Enter secrets only when replacing them. They remain write-only and are never returned by the
|
||
application.</li>
|
||
<li>Use <strong>Test connection</strong> whenever you want an informational connectivity check. Its result does
|
||
not enable or disable catalog operations.</li>
|
||
</ol>
|
||
<p>SSH uses a private key, optional key passphrase, mandatory <code>known_hosts</code>, and optional PostgreSQL
|
||
TLS CA/server name. REST prefers <code>POST /rpc/schema_snapshot</code>; when it is absent, the catalog may
|
||
use the same strict v1 snapshot through one read-only <code>POST /rpc/run_query</code>. An unavailable
|
||
capability, malformed snapshot, or connector error applies no catalog changes. See the
|
||
<a href="https://git.tylconsulting.it/mptyl/ThothII/src/branch/main/docs/contracts/catalog-schema-snapshot.md">schema snapshot contract</a>.</p>
|
||
<h2 id="synchronize-authoritative-schema-metadata">Synchronize authoritative schema metadata<a class="headerlink" href="#synchronize-authoritative-schema-metadata" title="Permanent link">¶</a></h2>
|
||
<p>Schema synchronization reads the external database and reconciles the installation-local catalog.
|
||
It never changes the source database. Every synchronization attempts a fresh connection when it
|
||
runs; an unreachable server or rejected credential fails that run without changing catalog data.
|
||
The available synchronization scopes are <strong>tables</strong>,
|
||
<strong>columns</strong>, <strong>relationships</strong>, and <strong>all</strong>, but the UI exposes them at different levels:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Location</th>
|
||
<th>Action</th>
|
||
<th>Effective scope</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td>Database view</td>
|
||
<td><strong>Synchronize tables</strong></td>
|
||
<td>All tables in the selected database</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Database view</td>
|
||
<td><strong>Synchronize relationships</strong></td>
|
||
<td>All physical foreign-key relationships in the selected database</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Database view</td>
|
||
<td><strong>Synchronize all</strong></td>
|
||
<td>Tables, columns, and physical relationships in the selected database</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Tables view</td>
|
||
<td><strong>Synchronize database tables</strong></td>
|
||
<td>All tables in the selected database. Selecting a table enables the action, but does not narrow its scope.</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Tables view</td>
|
||
<td><strong>Synchronize columns for selected tables</strong></td>
|
||
<td>Columns belonging to the selected tables</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Columns view</td>
|
||
<td><strong>Synchronize columns for this table</strong></td>
|
||
<td>All columns belonging to the table currently open. Selecting at least one column enables the action, but does not narrow its scope to that column.</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>There is no database-level column action and no synchronization action for an individual column.
|
||
The selection requirement in the tables and columns views controls whether the action selector can
|
||
be used; it is not always the same as the synchronization target. The <strong>Sync all</strong> button in the
|
||
tables view is the direct shortcut for the full-database scope.</p>
|
||
<p>Connection tests are informational and are never a synchronization prerequisite. Each
|
||
synchronization tests its own access while reading the schema; an unavailable connection fails
|
||
that operation with a connector error. Only one catalog operation can be active for a database at
|
||
a time; explicit cleanup shares this exclusion.</p>
|
||
<h3 id="what-a-synchronization-does">What a synchronization does<a class="headerlink" href="#what-a-synchronization-does" title="Permanent link">¶</a></h3>
|
||
<p>Every run first creates a durable queued operation and reads a schema snapshot. The scan reports
|
||
these phases:</p>
|
||
<ol>
|
||
<li>Connect to the database.</li>
|
||
<li>Read tables.</li>
|
||
<li>Read columns and primary-key positions.</li>
|
||
<li>Read foreign-key relationships.</li>
|
||
<li>Calculate the planned catalog difference.</li>
|
||
<li>Apply only the requested scope.</li>
|
||
</ol>
|
||
<p>The scan currently reads the complete physical snapshot, including foreign keys, even when the
|
||
requested scope is only tables or columns. This is required by the introspection contract and is
|
||
why the log can mention foreign-key reading during a table synchronization. Reading those keys
|
||
does not by itself create or update catalog relationships:</p>
|
||
<ul>
|
||
<li><strong>Synchronize tables</strong> writes table membership and source comments. If a table disappears, its
|
||
catalog columns and physical relationships are removed through the table cascade.</li>
|
||
<li><strong>Synchronize columns</strong> writes column membership and structural attributes for all tables or for
|
||
the selected table subset. It does not write physical relationships.</li>
|
||
<li><strong>Synchronize relationships</strong> writes the physical relationships derived from the source foreign
|
||
keys. It does not create generated or manual logical relationships.</li>
|
||
<li><strong>Synchronize all</strong> applies all three scopes and marks the database schema version as fully
|
||
synchronized.</li>
|
||
</ul>
|
||
<p>The run scans first and publishes a durable operation. If it detects a destructive difference, it
|
||
requires confirmation and re-scans before applying. You can cancel before apply; completed and
|
||
failed runs remain in history. The live log is delivered over SSE with a polling fallback.</p>
|
||
<p>The synchronization history records the requested scope, progress phases, planned changes,
|
||
confirmation, result counts, and errors. Closing the history drawer does not cancel a running
|
||
operation; it can be reopened from the database synchronization history control.</p>
|
||
<p>Explicit cleanup is different from source synchronization: administrators can clear selected
|
||
table/relationship or column/relationship catalog metadata without changing the external source,
|
||
the connection binding, or secrets. Deleting a table cascades to its columns and relationships.</p>
|
||
<h2 id="generate-and-consolidate-descriptions">Generate and consolidate descriptions<a class="headerlink" href="#generate-and-consolidate-descriptions" title="Permanent link">¶</a></h2>
|
||
<p>Generated descriptions can be requested for selected tables, selected columns, every eligible
|
||
target, or targets with a missing generated description. The backend accepts one installation-wide
|
||
run and processes targets sequentially. Every catalog column has a <strong>Sensitive</strong> flag, which defaults
|
||
to <code>false</code>, including after a newly discovered column is synchronized. Before generation, an
|
||
administrator can run local sensitivity analysis over the selected database, tables, or columns.
|
||
The analysis combines structural metadata with bounded read-only inspection of source values. It
|
||
uses no generative AI and no installation-catalog model. Assessments remain an unsaved draft until
|
||
a human reviews and saves them; the reviewer may reverse any proposal.</p>
|
||
<p>The page exposes separate histories for description generation and sensitivity analysis. Analysis
|
||
history stores the local policy version, scope, status, aggregate <code>sensitive</code>, <code>non_sensitive</code>, and
|
||
<code>unknown</code> counts, timestamps, and sanitized events. It does not store source values, per-column
|
||
proposals, NER spans, or worker diagnostics; closing an unsaved review discards that draft. The
|
||
rules, time bounds, and optional CPU-only NER profile are documented in
|
||
<a href="../sensitivity-analysis/">Local sensitivity analysis</a>.</p>
|
||
<p>For a column with <code>sensitive=false</code>, the worker may read at most five source rows and five
|
||
representative non-null values through a read-only connector. For <code>sensitive=true</code>, the source query
|
||
does not request that column's values; deterministic plausible values derived only from its name and
|
||
type take their place in the model prompt. The prompt does not identify those values as synthetic, so
|
||
the model can still describe the field as if it had received representative data.</p>
|
||
<p>Each successful result is persisted immediately. Stop terminates the active helper but retains
|
||
earlier results. A helper has at most one provider retry; three consecutively exhausted technical
|
||
batches fail the run. Stale queued/running work is marked interrupted at startup and can be
|
||
unlocked only when no local worker/helper is live. There is no automatic resume and no public
|
||
description-generation CLI.</p>
|
||
<p>Review generated text before copying it into the curated <strong>Description</strong> field. Because the flag
|
||
defaults to <code>false</code>, an administrator must review the classification and mark protected fields before
|
||
starting generation. Changing a flag affects future generations only; existing generated or curated
|
||
descriptions are not regenerated. Real and substituted samples remain transient and are not persisted
|
||
or returned to the browser.</p>
|
||
<p>The database-level <strong>Copy generated description to descriptions</strong> action applies every non-empty
|
||
AI-generated table and column description to the corresponding curated <strong>Description</strong> field in one
|
||
atomic operation. It skips empty generated descriptions, reports aggregate copied and skipped
|
||
counts, and retains the generated text. Because this can replace reviewed descriptions, the
|
||
interface requires explicit confirmation before applying it.</p>
|
||
<p>The decisions behind this surface are <a href="https://git.tylconsulting.it/mptyl/ThothII/src/branch/main/docs/adr/0001-postgres-metadata-catalog.md">ADRs 0001–0011</a>
|
||
and the detailed acceptance record is
|
||
<a href="https://git.tylconsulting.it/mptyl/ThothII/src/branch/main/docs/testing/2026-08-29-ai-catalog-description-generation-acceptance.md">AI catalog description generation acceptance</a>.</p>
|
||
|
||
<br>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div class="row wm-article-nav-buttons" role="navigation" aria-label="navigation">
|
||
|
||
<div class="wm-article-nav pull-right">
|
||
<a href="../sensitivity-analysis/" class="btn btn-xs btn-default pull-right">
|
||
Next
|
||
<i class="fa fa-chevron-right" aria-hidden="true"></i>
|
||
</a>
|
||
<a href="../sensitivity-analysis/" class="btn btn-xs btn-link">
|
||
Sensitive columns
|
||
</a>
|
||
</div>
|
||
|
||
<div class="wm-article-nav">
|
||
<a href="../workspaces/" class="btn btn-xs btn-default pull-left">
|
||
<i class="fa fa-chevron-left" aria-hidden="true"></i>
|
||
Previous</a><a href="../workspaces/" class="btn btn-xs btn-link">
|
||
Workspaces
|
||
</a>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<br>
|
||
</div>
|
||
|
||
<footer class="container-fluid wm-page-content">
|
||
<p>Documentation built with <a href="https://www.mkdocs.org/">MkDocs</a> using <a href="https://github.com/gristlabs/mkdocs-windmill">Windmill</a> theme by Grist Labs.</p>
|
||
</footer>
|
||
|
||
</body>
|
||
</html> |