mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-13 08:15:14 +02:00
docs(examples): use unified query history wording
This commit is contained in:
parent
f54107ac70
commit
16543a68f2
6 changed files with 43 additions and 33 deletions
|
|
@ -29,10 +29,11 @@ warehouse credential.
|
|||
|
||||
## postgres-historic
|
||||
|
||||
`postgres-historic/` is a manual Docker-backed smoke for Postgres historic-SQL
|
||||
ingest via `pg_stat_statements`. It verifies setup, unified Historic SQL artifacts,
|
||||
managed daemon batch SQL analysis, bounded pattern WorkUnit shards, and
|
||||
no-WorkUnit idempotency for unchanged bucketed table inputs and pattern shards.
|
||||
`postgres-historic/` is a manual Docker-backed smoke for Postgres
|
||||
query-history ingest via `pg_stat_statements`. It verifies setup, staged
|
||||
query-history artifacts, managed daemon batch SQL analysis, bounded pattern
|
||||
WorkUnit shards, and no-WorkUnit idempotency for unchanged bucketed table
|
||||
inputs and pattern shards.
|
||||
|
||||
## package-artifacts
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ storage:
|
|||
ingest:
|
||||
adapters:
|
||||
- fake
|
||||
- live-database
|
||||
agent:
|
||||
run_research:
|
||||
enabled: false
|
||||
|
|
|
|||
|
|
@ -11,8 +11,7 @@ storage:
|
|||
auto_commit: true
|
||||
author: "ktx <ktx@example.com>"
|
||||
ingest:
|
||||
adapters:
|
||||
- live-database
|
||||
adapters: []
|
||||
scan:
|
||||
enrichment:
|
||||
backend: none
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
# Postgres Historic SQL Example
|
||||
# Postgres Query History Example
|
||||
|
||||
This example is a manual smoke for the redesigned Postgres historic-SQL ingest
|
||||
path through `pg_stat_statements`. It starts Postgres 14 with the extension
|
||||
preloaded, generates query workload under separate users, runs `ktx setup` with
|
||||
`--enable-historic-sql`, and verifies the unified staged artifacts:
|
||||
This example is a manual smoke for Postgres query-history ingest through
|
||||
`pg_stat_statements`. It starts Postgres 14 with the extension preloaded,
|
||||
generates query workload under separate users, runs `ktx setup` with
|
||||
`--enable-query-history`, and verifies the staged query-history artifacts:
|
||||
|
||||
- `manifest.json`
|
||||
- `tables/*.json`
|
||||
|
|
@ -40,7 +40,7 @@ postgresql://ktx_reader:ktx_reader@127.0.0.1:55432/analytics # pragma: allowlist
|
|||
Set `KTX_POSTGRES_HISTORIC_KEEP_DOCKER=1` to leave the container running after
|
||||
the script exits.
|
||||
|
||||
The smoke validates the historic-SQL raw snapshot path without requiring LLM
|
||||
The smoke validates the query-history raw snapshot path without requiring LLM
|
||||
credentials. It uses KTX's local stage-only ingest API after `ktx setup`, so the
|
||||
deterministic reader, batch SQL parser, stable artifact writer, and diff-based
|
||||
WorkUnit planning are checked independently from curation.
|
||||
|
|
@ -54,7 +54,7 @@ docker compose -f examples/postgres-historic/docker-compose.yml up -d --wait
|
|||
examples/postgres-historic/scripts/generate-workload.sh base
|
||||
```
|
||||
|
||||
Create a project and enable historic SQL:
|
||||
Create a project and enable query history:
|
||||
|
||||
```bash
|
||||
export WAREHOUSE_DATABASE_URL=postgresql://ktx_reader:ktx_reader@127.0.0.1:55432/analytics # pragma: allowlist secret
|
||||
|
|
@ -69,8 +69,8 @@ node packages/cli/dist/bin.js --project-dir /tmp/ktx-postgres-historic setup \
|
|||
--new-database-connection-id warehouse \
|
||||
--database-url env:WAREHOUSE_DATABASE_URL \
|
||||
--database-schema public \
|
||||
--enable-historic-sql \
|
||||
--historic-sql-min-executions 2 \
|
||||
--enable-query-history \
|
||||
--query-history-min-executions 2 \
|
||||
--yes \
|
||||
--no-input
|
||||
```
|
||||
|
|
@ -87,24 +87,21 @@ The installed CLI form is:
|
|||
ktx status --project-dir /tmp/ktx-postgres-historic --no-input
|
||||
```
|
||||
|
||||
Expected output includes `PASS Postgres Historic SQL (warehouse)` when
|
||||
Expected output includes `PASS Postgres query history (warehouse)` when
|
||||
`pg_stat_statements` is installed, `pg_read_all_stats` is granted, and tracking
|
||||
is enabled. A low `pg_stat_statements.max` value is reported as an informational
|
||||
note, not a warning.
|
||||
|
||||
Run local historic-SQL ingest:
|
||||
Run query-history ingest:
|
||||
|
||||
```bash
|
||||
pnpm run ktx -- ingest run --project-dir /tmp/ktx-postgres-historic \
|
||||
--connection-id warehouse \
|
||||
--adapter historic-sql \
|
||||
--plain \
|
||||
--yes \
|
||||
pnpm run ktx -- ingest warehouse --project-dir /tmp/ktx-postgres-historic \
|
||||
--query-history \
|
||||
--no-input
|
||||
```
|
||||
|
||||
The full `ingest run` path also runs curation WorkUnits, so it requires a
|
||||
configured LLM provider.
|
||||
The public query-history ingest path also runs curation WorkUnits, so it
|
||||
requires a configured LLM provider.
|
||||
|
||||
Inspect the latest manifest:
|
||||
|
||||
|
|
@ -126,7 +123,7 @@ table.
|
|||
database.
|
||||
- Missing grants: confirm `GRANT pg_read_all_stats TO ktx_reader;`.
|
||||
- Empty snapshot: rerun `scripts/generate-workload.sh base` and keep
|
||||
`--historic-sql-min-executions 2` for the smoke.
|
||||
`--query-history-min-executions 2` for the smoke.
|
||||
- SQL-analysis failures: run `pnpm run ktx -- dev runtime status` from the KTX
|
||||
repository root and confirm `uv`, the bundled Python wheel, and the managed
|
||||
runtime all pass.
|
||||
|
|
|
|||
|
|
@ -215,8 +215,8 @@ node "$KTX_BIN" --project-dir "$PROJECT_DIR" setup \
|
|||
--new-database-connection-id warehouse \
|
||||
--database-url env:WAREHOUSE_DATABASE_URL \
|
||||
--database-schema public \
|
||||
--enable-historic-sql \
|
||||
--historic-sql-min-executions 2 \
|
||||
--enable-query-history \
|
||||
--query-history-min-executions 2 \
|
||||
--yes \
|
||||
--no-input
|
||||
|
||||
|
|
|
|||
|
|
@ -64,11 +64,17 @@ describe('standalone example docs', () => {
|
|||
const smoke = await readText('examples/postgres-historic/scripts/smoke.sh');
|
||||
|
||||
assert.match(examples, /postgres-historic/);
|
||||
assert.match(examples, /unified Historic SQL artifacts/);
|
||||
assert.match(readme, /--enable-historic-sql/);
|
||||
assert.match(readme, /--historic-sql-min-executions 2/);
|
||||
assert.doesNotMatch(examples, /Historic SQL/);
|
||||
assert.doesNotMatch(examples, /historic-SQL/);
|
||||
assert.match(examples, /query-history ingest via `pg_stat_statements`/);
|
||||
assert.doesNotMatch(readme, /--enable-historic-sql/);
|
||||
assert.doesNotMatch(readme, /--historic-sql-min-executions/);
|
||||
assert.doesNotMatch(readme, /ktx ingest run --project-dir/);
|
||||
assert.doesNotMatch(readme, /--adapter historic-sql/);
|
||||
assert.match(readme, /--enable-query-history/);
|
||||
assert.match(readme, /--query-history-min-executions 2/);
|
||||
assert.match(readme, /ktx status --project-dir/);
|
||||
assert.match(readme, /Postgres Historic SQL/);
|
||||
assert.match(readme, /Postgres query history/);
|
||||
assert.match(readme, /manifest\.json/);
|
||||
assert.match(readme, /tables\/\*\.json/);
|
||||
assert.match(readme, /patterns-input\.json/);
|
||||
|
|
@ -90,7 +96,7 @@ describe('standalone example docs', () => {
|
|||
assert.match(smoke, /historic-sql-patterns-part-/);
|
||||
assert.match(smoke, /patterns-input\/part-/);
|
||||
assert.doesNotMatch(smoke, new RegExp(["unitKey === 'historic", 'sql', "patterns'"].join('-')));
|
||||
assert.match(smoke, /--historic-sql-min-executions 2/);
|
||||
assert.match(smoke, /--query-history-min-executions 2/);
|
||||
assert.match(smoke, /KTX_RUNTIME_ROOT/);
|
||||
assert.match(smoke, /managedDaemon/);
|
||||
assert.match(smoke, /installPolicy: 'auto'/);
|
||||
|
|
@ -130,6 +136,14 @@ describe('standalone example docs', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('checked-in example configs do not include public live-database adapters', async () => {
|
||||
const localWarehouseConfig = await readFile('examples/local-warehouse/ktx.yaml', 'utf8');
|
||||
const orbitConfig = await readFile('examples/orbit-relationship-verification/ktx.yaml', 'utf8');
|
||||
|
||||
assert.doesNotMatch(localWarehouseConfig, /live-database/);
|
||||
assert.doesNotMatch(orbitConfig, /live-database/);
|
||||
});
|
||||
|
||||
it('lists every workspace package in the contributor docs', async () => {
|
||||
const contributing = await readText('docs-site/content/docs/community/contributing.mdx');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue