dimanche 26 juin 2016

How to separate exported data from Postgres into distinct tabs in CSV format?

I am trying to export data from Postgres to CSV so that I can import it to stormpath, which requires:

"It also requires the CSV file to have columns:

  • username
  • email
  • given_name
  • surname
  • custom_data

It requires the CSV file to have comma delimited fields, and fields quoted with a pipe character |."

So far, I am able to export the data from Postgres but I am not able to separate the data across multiple tabs with a '|' as delimiter.

Separates data with a non visible ',' as delimiter and spreads the data across the tabs under their respective key

COPY (SELECT * FROM servicers) TO '/Users/V/Desktop/s.csv' DELIMITER ',' CSV HEADER;

Separates data with '|' as delimiter but keeps all data in one tab as opposed to individual tabs

COPY (SELECT * FROM servicers) TO '/Users/V/Desktop/s.csv' DELIMITER '|' CSV HEADER;

Aucun commentaire:

Enregistrer un commentaire