fun_export.R

Apply a function FUN to a query and export it to a file. 
If dealing with large datasets, it´s sometimes easier to query the database in chunks, process each chunk and export each chunk to a file. I needed to do this and export the data to another database and couldn´t read the hole table in memmory