Created
April 24, 2014 15:49
-
-
Save ruprict/11259551 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def update_sb_for_bad_cards(increment=500) | |
cmd = OrientDB::SQLCommand.new("select count(*) from card") | |
res = Oriented.graph.command(cmd).execute | |
count = res.to_a.first["count"] | |
loop_count = count/increment | |
start_id = 0 | |
(0..loop_count).each do |num| | |
end_id = start_id + increment | |
sql = "create edge Card__sanctioning_body from " + | |
"(select from Card where @rid >= #24:#{start_id} " + | |
"and @rid < #24:#{end_id} and out_Card__sanctioning_body "+ | |
"is null and out_Card__carded_user is not null) to #13:0" | |
cmd = OrientDB::SQLCommand.new(sql) | |
Oriented.graph.command(cmd).execute | |
Oriented.graph.commit | |
puts "*** #{end_id} complete" | |
start_id = end_id | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment