casperin / pg-amigo

1 stars 1 forks source link

Export data from a table #6

Open sorribas opened 6 years ago

sorribas commented 6 years ago

Let's use pg_dump and export the whole database in SQL instead, this sounds like more useful to most people. Maybe later we can add some functionality to export tables to CSV or other formats individually, but right now it doesn't sound like the most useful feature.

casperin commented 6 years ago

I don't recall how we agreed to do this on Wed. I guess I was too tired.

Dump it in a tmp file and then stream that up?

sorribas commented 6 years ago

pg_dump outputs the dump to stdout, so the idea would be to create a pg_dump process with the connection info to the db and read from it's stdout.

casperin commented 6 years ago

Oh nice, I didn't even realize it went to stdout. Even simpler :)

casperin commented 6 years ago

I wanted to see if I could do it, and of course ended up actually implementing it. I pushed it, but feel free to abolish the code as you please. There are probably errors in it anyway :)