Skip to content
This repository has been archived by the owner on Jul 21, 2020. It is now read-only.

Commit

Permalink
updated simple batch export script
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Trautmann committed Feb 1, 2012
1 parent 22c900e commit 03c50dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion config/deploy
21 changes: 7 additions & 14 deletions script/export_all_xml
@@ -1,15 +1,8 @@
i = 0
while true do
assets = Asset.find(:all, :limit => 1000, :offset => i)
if assets.count > 0
assets.each do |asset|
filename = "/tmp/pbcore_export/" + asset.uuid + ".xml"
file = File.open(filename, "w")
file.puts asset.to_xml
file.close
end
i += 1000
else
break
Asset.find_in_batches(:batch_size => 100 ) do |assets|
assets.each do |asset|
filename = "/tmp/pbcore_export/" + asset.uuid + ".xml"
file = File.open(filename, "w")
file.puts asset.to_xml
file.close
end
end
end

0 comments on commit 03c50dc

Please sign in to comment.