I am working in django and trying to figure out how to export a table i have in my database to a yaml file, but cant find the solution to it..probably some simple change.. Right now i have a written a bash to export my customer table to a CSV file that works fine:
export_customer.sh
echo "Enter the directory path to save the file"
read path_to_save
file_name="myFile.csv"
psql --dbname=mydb --host=localhost --username=mydb -c "COPY
(
select name, id from customers
) to stdout DELIMITER ',' CSV HEADER" > "${path_to_save}/${file_name}"
My customer table look something like this:
id name
-------------------
1 xxxxx
2 yyyyy
Does anyone now how to export this into a yaml file instead?