# Column analysis

> Aggregate filters, joins, SELECT INTO mappings, and predicates per procedure or package — the machine-readable entry point for test-data and mock generation.

---

LLMS index: [llms.txt](/codeweb/llms.txt)

---

## Aggregate per procedure {#aggregate-per-procedure}

`codeweb columns` exports, per procedure or package: hard filters, join conditions, `SELECT INTO` mappings, and enum/column mappings. Exactly one of `--procedure` or `--package` is required:

```bash
codeweb columns --procedure "proc_create_order" --format json
codeweb columns --package "pkg_order" --format json
codeweb columns --package "pkg_order" --table "orders" --format json   # narrow to one table
```

Output is JSON (schema from issue #165). `--procedure` and `--package` use the same substring matching as `trace`; matching more than one node fails the command.

## Seed hints {#seed-hints}

`--format seed-hints` (issue #181) renders a table-requirements inventory for generating test data: involved tables with per-table operations, the routine signature, hard filters, cross-table equalities, and discriminator values. Each entry carries provenance and confidence.

```bash
codeweb columns --procedure "proc_create_order" --format seed-hints
codeweb columns --procedure "proc_create_order" --format seed-hints \
  --discriminator "operation_no"
```

- `--discriminator` names a column whose literal values are enumerated as `discriminator_values`. The flag is repeatable and overrides the `discriminator_columns` list from `codeweb.toml`:

```toml
[analysis]
discriminator_columns = ["operation_no"]
```

By default the list is empty: codeweb has no built-in domain knowledge, so a project opts in explicitly.

## Predicates {#predicates}

`codeweb predicates --procedure <NAME>` resolves PL `IF`/`CASE` conditions to table columns and outputs JSON:

```bash
codeweb predicates --procedure "proc_create_order" --format json
```

`--format json` is the only supported value today.

## Mark WDR report rows {#mark-wdr-report-rows}

`codeweb mark` annotates rows of a WDR SQL detail CSV with their relation to a target graph node — useful for tying slow-SQL reports back to procedures and mappers:

```bash
codeweb mark --csv wdr_sql_detail.csv --node "proc_create_order" -o marked.csv
codeweb mark --csv wdr_sql_detail.csv --node "orders" --node "pkg_order"   # multiple targets, stdout
```

## Interfaces {#interfaces}

The aggregated column analysis is exposed on every surface:

- CLI: `codeweb columns`, `codeweb predicates`
- HTTP: `GET /api/v1/columns?procedure=...|package=...[&table=...]`
- MCP: `codeweb_column_analysis` (same JSON schema as the CLI)

---

Backlinks:

- [CLI reference](/codeweb/docs/cli-reference/)
- [Lineage](/codeweb/docs/lineage/)
