sqlexport: rewrite "to sql file" export to use streaming