Skip to content

Instantly share code, notes, and snippets.

@chyld
Last active December 12, 2015 03:38
Show Gist options
  • Save chyld/4708650 to your computer and use it in GitHub Desktop.
Save chyld/4708650 to your computer and use it in GitHub Desktop.
require 'pg'
require 'pry'
conn = PG.connect(:dbname =>'db_name', :host => 'localhost')
conn.exec( "select * from table_name" ) do |result|
result.each do |row|
puts row['a1']
end
end
conn.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment