a JSON schema for postgres ``EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS)` yaml or json.
Unfortunately, the schema is hand-maintained.
- I generated many the output of many
EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS, FORMAT YAML)
queries inpg_inventory
- an initial skeleton of the schema was generated with the python
genson
package using./scripts/generate_initial_schema.py
, - guessing which string types have constrained values, (i.e. any key ending in " Type:"), I used
./scripts/collect_enums.sh
to generate enumeration values and hand-defined the enumerations - I extracted a definition of a
Plan
object and used it to recursively define itself - I transformed the JSON into the primary document,
schema.yaml
using./scripts/to_yaml.py
- I test the definition against the corpus of YAML I have using
./scripts/validate_schema_against_corpus.py
. - Re-transform
schema.yaml
intoschema.json
for easier distribution