Hello, On Fri, May 18, 2012 at 3:00 PM, rohit <[email protected]> wrote:
> On Thursday, May 17, 2012 9:51:53 AM UTC-5, Jeremy Evans wrote: >> >> On Thursday, May 17, 2012 7:17:16 AM UTC-7, Kartik Rustagi wrote: >>> >>> While to_csv function is great if my data is not having commas but the >>> ability to mention the separator explicitly will be great. Is there a way >>> to output a Dataset in a tab separated csv? >>> Right now I have no other means to do this other than to iterate through >>> each entry generating a string using tab as separator and this is extremely >>> slow. >>> >>> Any help will be greatly appreciated. >>> >> >> Dataset#to_csv is really for backwards compatibility only, as it doesn't >> even use a real csv library. I don't see how iterating through the >> entries yourself could be slower, as that is what Dataset#to_csv does. >> Look at the source code of the method (https://github.com/** >> jeremyevans/sequel/blob/**master/lib/sequel/dataset/**actions.rb#L553<https://github.com/jeremyevans/sequel/blob/master/lib/sequel/dataset/actions.rb#L553> >> ). >> >> I'll consider adding support for a different separator if I see some >> community support behind this proposal. So if other users here want this >> feature, please speak up. >> >> Thanks, >> Jeremy >> > > Or use FasterCSV which will quote any fields that include the separator. > https://gist.github.com/2727033 > FasterCSV was included into 1.9 as the standard csv library ( http://stackoverflow.com/questions/5011395/what-is-ruby-1-9-standard-csv-library ). -Bill -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
