question

kopiko avatar image
kopiko asked

Is there a script that automatically exports the queried result to a csv file locally?

I'm using a Postgre database for work. I have this script that I made which basically returns over 500K rows with multiple columns. Daily, I would run this and save the results to a CSV file. Is there a syntax/script that can automate the exporting to CSV task?

Thanks!

scriptscript-taskpostgresql
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
ThomasRushton avatar image
ThomasRushton answered

Powershell?

Get your query result set, and pass it into Export-Csv. Then you can schedule that script in Windows Task Scheduler

10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.