class PostgresToRedshift::Table

Attributes

attributes[RW]
columns[RW]

Public Class Methods

new(attributes: , columns: []) click to toggle source
# File lib/postgres_to_redshift/table.rb, line 18
def initialize(attributes: , columns: [])
  self.attributes = attributes
  self.columns = columns
end

Public Instance Methods

columns=(column_definitions = []) click to toggle source
# File lib/postgres_to_redshift/table.rb, line 32
def columns=(column_definitions = [])
  @columns = column_definitions.map do |column_definition|
    Column.new(attributes: column_definition)
  end
end
columns_for_copy() click to toggle source
# File lib/postgres_to_redshift/table.rb, line 44
def columns_for_copy
  columns.map do |column|
    column.name_for_copy
  end.join(", ")
end
columns_for_create() click to toggle source
# File lib/postgres_to_redshift/table.rb, line 38
def columns_for_create
  columns.map do |column|
    %Q["#{column.name}" #{column.data_type_for_copy}]
  end.join(", ")
end
is_view?() click to toggle source
# File lib/postgres_to_redshift/table.rb, line 50
def is_view?
  attributes["table_type"] == "VIEW"
end
name() click to toggle source
# File lib/postgres_to_redshift/table.rb, line 23
def name
  attributes["table_name"]
end
Also aliased as: to_s
target_table_name() click to toggle source
# File lib/postgres_to_redshift/table.rb, line 28
def target_table_name
  name.gsub(/_view$/, '')
end
to_s()
Alias for: name