这是我当前从 CSV 导入的 rake 任务,我可以重写它以导入和删除前两列/使用空格作为分隔符将数据连接到一个 latlon 列吗?
require 'csv'
desc "Import public library data from csv file"
task :import => [:environment] do
namespace :import_incidents_csv do
task :create_incidents => :environment do
ActiveRecord::Base.connection.execute "COPY PublicLibraryBranchLocations (DistrictNumber, DistrictName, LibrarySystem, Type, Branch, Phone, Email, Website, PhysicalAddress, City, Province, PostalCode, Latitude, Longitude) FROM '/home/mgmacri/data/PublicLibraryBranchLocations.csv' DELIMITER ',' CSV;"
end
end
end