Sha256: 64084df55ecbac689027838db8c38c552bcd66ec9b02952c0753e79a94c627c3
Contents?: true
Size: 881 Bytes
Versions: 3
Compression:
Stored size: 881 Bytes
Contents
require_relative "../helpers/errors" require "pry" module CsvImportAnalyzer module QueryHelper def form_query_for_datatype(args) unless args[:datatype].nil? || args[:header].nil? if args[:datatype] == :string return args[:header].to_s + " varchar(255)" else return args[:header].to_s + " " + args[:datatype].to_s end else MissingRequiredArgumentsError.new("Required arguments missing for form_query_for_datatype") end end def import_csv(args) unless args[:tablename].nil? || args[:filename].nil? || args[:delimiter].nil? pg_import_statement = "COPY #{args[:tablename]} FROM '#{args[:filename]}' HEADER DELIMITER '#{args[:delimiter]}' CSV NULL AS 'NULL';" else MissingRequiredArgumentsError.new("Required arguments missing for import_csv") end end end end
Version data entries
3 entries across 3 versions & 1 rubygems