bug fix in add_data.py

Now uses a loop with exception handling to stop attempts to insert rows
with primary keys that already exist.