Skip to content

Instantly share code, notes, and snippets.

@toyama0919
Created November 21, 2013 16:19
Show Gist options
  • Save toyama0919/7584737 to your computer and use it in GitHub Desktop.
Save toyama0919/7584737 to your computer and use it in GitHub Desktop.
railsからredshiftに接続する ref: http://qiita.com/toyama0919/items/8de293cb11178a8b999e
redshift:
adapter: redshift
database: applog
host: *****.**********.ap-northeast-1.redshift.amazonaws.com
port: 5439
username: app
password:
encoding: utf8
pool: 5
timeout: 30000 # タイムアウトは長めに
sudo yum install postgresql postgresql-devel
bundle install
ActiveRecord::Base.establish_connection(:redshift)
result = ActiveRecord::Base.connection.execute "select * from table_name where log_date='#{d.strftime("%Y-%m-%d")}'"
result.each{|record|
p record # hash
}
gem "activerecord-redshift-adapter"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment