class TableSaw::Formats::Copy

Public Instance Methods

dump_row(row) click to toggle source
# File lib/table_saw/formats/copy.rb, line 14
def dump_row(row)
  row
end
header() click to toggle source
# File lib/table_saw/formats/copy.rb, line 6
def header
  "COPY #{table_name} (#{quoted_columns}) FROM STDIN;"
end

Private Instance Methods

connection() click to toggle source
# File lib/table_saw/formats/copy.rb, line 27
def connection
  TableSaw.schema_cache.connection
end
quoted_columns() click to toggle source
# File lib/table_saw/formats/copy.rb, line 20
def quoted_columns
  TableSaw.schema_cache.columns_hash(table_name)
    .each_key
    .map { |name| connection.quote_column_name(name) }
    .join(', ')
end