El Mon, 10 de Dec de 2012, a las 09:19:45AM -0800, Jeremy Evans dijo:
> First, COPY with a filename specifies a filename on the server, not on the 
> client, which is why you need to be a superuser to use it.  I'm guessing 
> the file you are trying to use is on the client, so you can't do that.  If 
> the file actually is on the server, that DB.run command should work if you 
> are a superuser and the database system user has appropriate permissions to 
> the file.
Hi Jeremy thanks for the answer! the file is on the server

> 
> Second, with Sequel you need to use DB.copy_into for COPY FROM STDIN.  
> Maybe something like this:
> 
>   DB.copy_into(:user, :columns=>[:name, :surname], 
> :data=>File.new("/home/gramos/download/my_file.csv", "rb"), 
> :options=>"DELIMITER '|'")

awesome, right now I'm using PG driver directly using put_copy_data method
[1], but I didn't know about DB.copy_into, I'll try it!

[1] 
http://gastonramos.wordpress.com/2012/12/10/como-usar-copy-from-con-ruby-y-pg-driver/

Cheers.

> 
> Jeremy
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sequel-talk" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/sequel-talk/-/b076gQdeZV0J.
> 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.
> 

-- 
"Optimism is an occupational hazard of programming; feedback is the treatment."

(Kent Beck)


+-------------------------------------+
Gastón Ramos
http://gastonramos.com.ar/
GNU/Linux Counter user #450312

-- 
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.

Reply via email to