Class: ExportToGcloud::CSVExporter

Inherits:
Exporter
  • Object
show all
Defined in:
lib/export_to_gcloud/exporters/csv_exporter.rb

Instance Method Summary collapse

Methods inherited from Exporter

#add_data_part, #bq_table, define, #get_storage_files, #initialize, #local_file_path, #process_all_parts!, #process_part!, #recreate_bq_table!, #start_load_job, #storage_file_path, #upload_file!

Constructor Details

This class inherits a constructor from ExportToGcloud::Exporter

Instance Method Details

#create_data_file!(file, *part_data) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/export_to_gcloud/exporters/csv_exporter.rb', line 6

def create_data_file! file, *part_data
  data = @definition.get_data(*part_data)

  csv_data = CSV.generate col_sep: ';', force_quotes: false do |csv|
    data.each{|row| csv << row}
  end

  File.write file.to_path, csv_data
end