Skip to content

Instantly share code, notes, and snippets.

@tariqhamid
Created May 27, 2019 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tariqhamid/f322930f894d5ea5d13c3de91f2cc48e to your computer and use it in GitHub Desktop.
Save tariqhamid/f322930f894d5ea5d13c3de91f2cc48e to your computer and use it in GitHub Desktop.
=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