No commit activity in last 3 years
No release in over 3 years
This gem provides the Rails 3 with database adapter for AWS RedShift.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

>= 3.0.0
>= 3.0.0
>= 0
 Project Readme

activerecord-redshift-adapter

adapter for aws redshift for rails 3

Ripped from rails 3 postgresql.

example database.yml

common: &common
  adapter: postgresql
  username: postgres
  encoding: SQL_ASCII
  template: template0
  pool: 5
  timeout: 5000

redshiftdb: &redshiftdb
  adapter: redshiftbulk
  host: clustername.something.us-east-1.redshift.amazonaws.com
  database: databasename
  port: 5439
  username: username
  password: password

redshift_development:
  <<: *common
  <<: *redshiftdb
  database: databasename

options

<table>
  <tr>
    <th>option</th>
    <th>description</th>
  </tr>
  <tr>
    <th>schema_search_path</th>
    <td>set schema_search_path. use default value if not given.</td>
  </tr>
  <tr>
    <th>read_timezone</th>
    <td>force timezone for datetime when select values. ActiveRecord default timezone will set if not given.</td>
  </tr>
</table>

Have you considered using Partitioned gem? It works with redshift!

https://github.com/fiksu/partitioned

TableManager

Helpful code to clone redshift tables

create table foos
(
  id int not null primary key distkey,
   name varchar(255) unique sortkey
);
class Foo < ActiveRecord::Base
end

require 'activerecord_redshift_adapter'

table_manager = ActiverecordRedshift::TableManager.new(Foo.connection, :exemplar_table_name => Foo.table_name)
table_manager.duplicate_table

yields:

  select oid from pg_namespace where nspname = 'public' limit 1;

  select oid,reldiststyle from pg_class where relnamespace = 2200 and relname = 'foos' limit 1;

  select contype,conkey from pg_constraint where connamespace = 2200 and conrelid = 212591;

  select attname,attnum from pg_attribute where attrelid = 212591 and attnum in (2,1);

  show search_path;

  set search_path = 'public';

  select * from pg_table_def where tablename = 'foos' and schemaname = 'public';

  create temporary table temporary_events_25343
  (
   id integer not null distkey,
   name character varying(255),
   primary key (id),
   unique (name)
  ) sortkey (name);

  set search_path = '$user','public';