Last active
August 29, 2015 13:57
-
-
Save boblannon/9793328 to your computer and use it in GitHub Desktop.
py translation of pseudocode in https://source.opennews.org/en-US/learning/sane-data-updates-are-harder-you-think/
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
all_records_that_are_new_or_changed_since_your_last_import = get_all_records_that_are_new_or_changed_since_your_last_import() | |
for record in all_records_that_are_new_or_changed_since_your_last_import: | |
found = find_the_record_in_your_old_data(record) | |
if not found: | |
add_the_record(record) | |
if found: | |
change_whatever_bits_of_the_record_are_different(record) | |
all_your_existing_data = get_all_your_existing_data() | |
for datum in all_your_existing_data: | |
if not in_source_data_any_longer(datum): | |
delete_datum(datum) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment