2

I'm currently using Jitterbit Dataloader.

I have an object called 'Project' and it has a self relationship (lookup) called 'Parent Projects'. During an initial import there are no parent projects so the import fails with

"Foreign Key External ID XXXXX not found for field ... "

This error makes sense because the parent project doesn't exist yet.

As for now, I've done an initial upsert without the Parent ID. Then I do a second upsert with the Parent ID. However, I'm going to be scheduling this to run constantly and just wondering how others handle this situation. It doesn't seem very efficient to do two passes when upserting the data.

What is the best practice for this type of situation?

Any suggestions?

2
  • 4
    I faced the same challenge, and also ended up doing the double pass - though the second pass was very fast since I was just updating the parent. I don't see another way - I thought about ordering the list to make sure I inserted the parents first, but unless you can structure the batches to never upsert parents and children at in the same batch of records, I don't see another way? Commented Mar 20, 2013 at 18:47
  • 1
    Somewhat academic sidenote. The only solution to do this in one pass would be to do a [dependency sort][1] on youz records before and then insert them in that order. But thats much harder than the double pass solution. [1]: en.wikipedia.org/wiki/Topological_sorting Commented Mar 26, 2013 at 9:22

1 Answer 1

0

Have you tried setting batch size to one? You might find this question helpful also: Workbench - Inserting Records with Self Lookup via Smart Lookup

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .