Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

activerecord-redshift-adapter

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

activerecord-redshift-adapter

  • 0.9.12
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

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: redshift
  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';

FAQs

Package last updated on 30 Mar 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc