dteq is a query tool that passes results through a template. It is well-suited for auto-generating all kinds of things from a database like authentication tables, DNS zone files, or whatever you can come up with. It also does updating commands like INSERT and UPDATE and reports back the number of rows affected. This used to be named mysqlquery but it is now DB-independent. It has a MySQL, a PostgreSQL, and a cdb driver. Adding support for other data sources is trivial.
You can download version 0.6 here.
0.6 contains small fixes, and an experimental PostgreSQL driver.