Skip to content

Instantly share code, notes, and snippets.

@paddor
Created September 28, 2010 06:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paddor/600490 to your computer and use it in GitHub Desktop.
Save paddor/600490 to your computer and use it in GitHub Desktop.
warn "Opening database connection ..."
DB = Sequel.postgres(:host=>'localhost', :user=>'logs', :database=>'logs')
warn "Running COPY command with data ..."
DB.run copy_command
DB.synchronize do |conn|
ret = conn.put_copy_data(copy_data) # or raise "could not send COPY data"
warn "Sent COPY data: #{ret}"
ret = conn.put_copy_end # or raise "could not send COPY end"
warn "Sent COPY end: #{ret}"
end
DB.disconnect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment