I wrote the `ysql` Perl application for exactly this problem
But it would have been better to build off a well tested module as a basis for my set of tools, sigh. I could have used yaml as an intermediary.
A favorite saying is from chemistry -- with a few weeks of hard work in the lab, you can save hours in the library...