Created
May 27, 2019 19:41
-
-
Save tariqhamid/f322930f894d5ea5d13c3de91f2cc48e 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
=begin | |
count = 0 | |
obj.get(range: "bytes=0-1027") do |chunk| | |
# check whether this file has already been loaded into os_address table | |
# chunk.lines.first.split(',')w | |
line = chunk.lines.first | |
# line = "\"" + chunk.lines.first unless line[0] == "\"" | |
file_first_line = CSV.parse(line, :liberal_parsing => true) | |
pc = file_first_line[0][65] | |
puts "checking postcode #{pc} from file #{obj.key}" | |
vals = conn.exec_query("select count(*) from os_address where POSTCODE = '#{pc}';") | |
count = vals[0]['count'] | |
if vals[0]['count'].zero? | |
puts "postcode #{pc} not found in file #{obj.key}" | |
else | |
puts "Skipping #{obj.key}" | |
end | |
break | |
end | |
if count.zero? | |
=end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment