[英]NoMemoryError: failed to allocate memory
我有一個包含大量數據的xlsx文件,並且我有此腳本可以將xlsx文件中的數據插入到我自己的數據庫中:
file = 'lib/assets/sicepatfull.xlsx'
xlsx = Roo::Spreadsheet.open(file)
sheet = xlsx.sheet(0)
attrs = sheet.row(1)
data = sheet.parse(header_search: attrs).map do |d|
d.map {|k, v| [k.parameterize.underscore.to_sym, v] }.to_h.except :id
end
Courier.create!(data)
在attrs
之后取消該命令,結果是: NoMemoryError: failed to allocate memory
。
我如何解決它?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.