I'm trying to export data from table to csv using COPY command. Here is my code
String copyQuery="COPY "+tableName+ " TO STDOUT WITH DELIMITER '~' CSV HEADER";
System.out.println(copyQuery);
try {
FileWriter fw=new FileWriter(FilePath);
new CopyManager((BaseConnection) conPost)
.copyOut(
copyQuery, fw
);
fw.close();
logger.info("postgres side csv generated");
}
When I look into CSV the output is like:- 1~vignesh~java
But, I prefer the strings to be in double quotes :- 1~"vignesh"~"java"
How can I achieve this??????
Thanks in advance