
Storing YAML Text in a Database Column and Its Pitfalls
What goes wrong when YAML is kept as text in a column: LIKE misses, equal documents compare unequal and garbage is accepted. The jsonb alternative fixes each.
Everything you need to level up your coding skills.

What goes wrong when YAML is kept as text in a column: LIKE misses, equal documents compare unequal and garbage is accepted. The jsonb alternative fixes each.

Export a PostgreSQL table to YAML with psycopg and PyYAML. Fix the UUID error, keep numerics exact as strings and compare with a to_jsonb pipeline.

Load a YAML list into PostgreSQL 18 with psycopg: adapt dates, arrays and jsonb, rerun safely with ON CONFLICT and let constraints reject bad rows.

Five jobs YAML does next to a database: seed data, exports, stored documents, test fixtures and queries, with tested code for PostgreSQL, SQLite and DuckDB.

What survives when YAML becomes JSON, CSV, XML or Excel and back, with a tested loss matrix, the type traps in each direction and a conversion checklist.

A two-line YAML diff can move a key to another level or turn a string into a float. Review the loaded data, not the text, with a short script and a linter.

Pick one key style, enforce it with a JSON Schema pattern and fix old files with a yq command that renames every key. Real output for each step.

What to write in YAML comments, what to leave out and how to lint comment style. Includes yamllint output for spacing and indentation, and what tools drop.

Write a JSON Schema for a YAML config, run check-jsonschema in CI, get every error with a path, and know that the loader decides what NO and 3.10 are.

Put shared settings in one anchored block and merge it into each service. The web service replaced the whole environment block, since the merge is shallow.

Keep one base file and small overrides per environment, merge them in order and print the effective config with the source of each value. Tested layers.

A password removed from a YAML file stayed in Git history. Reference secrets by name, scan the tree and the history, and rotate anything that was committed.
We send one email when a new article is published. No spam.