Sha256: 86e07a2b67e9df0627380aff061a1d7c8c5c399aa4d20fa0336232dfc451415e
Contents?: true
Size: 869 Bytes
Versions: 6
Compression:
Stored size: 869 Bytes
Contents
require_relative "../helpers/errors" 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
6 entries across 6 versions & 1 rubygems