I am trying to wrap my head around how to test Key values in a CSV file against its parent database.
I have a table with address values, each record with a numeric key. This table has many duplicates, each with a unique key.
I have a program that has taken duplicates and pointed them to a 'parent' key to hand off any relationships that may be tied to that key.
example:
Key StreetNo StreetName Unit
--- -------- ---------- ----
2 123 5th
8 123 5th A
1 123 5th
This would be in my CSV file: 2, 8, 1
Note that I am only looking at StreetNo and StreetName. Also, there are instance of many duplicates, the next CSV row may be something like 4, 5, 6, 9, 11
I need to test this file for accuracy, that an address won't point off to a parent of a wrong address. I only want to test StreetNo and Name.
I know I can read in a CSV using SQL- however my CSV columns vary. The right way to go would be to take the first key in the CSV, concatenate StreetNO and StreetName, store it, and then compare it with the rest of the keys' concatenated values. Repeat for the length of the CSV.
Example:
CSV 2, 8, 1
2 = "123 5th"; check against "123 5th", "123 5th"
If there was no match, the CSV row would be printed.
I'm at a standstill, has anyone approached this type of dynamic CSV testing - the logic is simple but I'm stuck implementing.