Class: Sequel::Redshift::Database

Inherits:
Postgres::Database show all
Defined in:
lib/sequel/adapters/redshift.rb

Constant Summary collapse

SORTSTYLES =
[:compound, :interleaved].freeze
DISTSTYLES =
[:even, :key, :all].freeze
DatasetClass =
self

Instance Method Summary collapse

Methods inherited from Postgres::Database

#type_literal_generic_suuid

Instance Method Details

#connection_configuration_sqlsObject



34
35
36
# File 'lib/sequel/adapters/redshift.rb', line 34

def connection_configuration_sqls
  []
end

#optimize_table(table, create_options) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/sequel/adapters/redshift.rb', line 12

def optimize_table(table, create_options)
  extension :redshift_schema_dumper
  transaction do
    gen = dump_table_generator(table)

    rename_table table, :"old_#{table}"
    create_table(:"new_#{table}", create_options) do
      instance_eval(gen.dump_columns,     __FILE__, __LINE__)
      instance_eval(gen.dump_constraints, __FILE__, __LINE__)
      instance_eval(gen.dump_indexes,     __FILE__, __LINE__)
    end
    run %Q{INSERT INTO "new_#{table}" (SELECT * FROM "old_#{table}")}
    rename_table :"new_#{table}", table
    drop_table :"old_#{table}"
  end
end

#serial_primary_key_optionsObject



29
30
31
32
# File 'lib/sequel/adapters/redshift.rb', line 29

def serial_primary_key_options
  # redshift doesn't support serial type
  super.merge(serial: false)
end

#supports_index_parsing?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/sequel/adapters/redshift.rb', line 38

def supports_index_parsing?
  false
end