Re: [Rails] Postgres COPY from STDIN

2012-03-21 Thread Philip Hallstrom
On Mar 20, 2012, at 8:49 PM, Tim Uckun wrote: I have done some googling to try and figure out how I can use COPY FROM STDIN with rails and have ran into some posts on stackoverflow or the mailing list but none of them seem to be working with rails 3.2 Does anybody have a working example of

Re: [Rails] Postgres COPY from STDIN

2012-03-21 Thread Tim Uckun
conn = ActiveRecord::Base.connection_pool.checkout raw  = conn.raw_connection raw.exec(COPY tablename (col1, col2, col3) FROM STDIN) # open up your CSV file looping through line by line and getting the line into a format suitable for pg's COPY... rc.put_copy_data line # once all done...

[Rails] Postgres COPY from STDIN

2012-03-20 Thread Tim Uckun
I have done some googling to try and figure out how I can use COPY FROM STDIN with rails and have ran into some posts on stackoverflow or the mailing list but none of them seem to be working with rails 3.2 Does anybody have a working example of using COPY FROM STDIN? Some things I have tried