Transport Dependencies
Dependencies Between Transports
Often it is the case that data files are dependent upon each other; that one
data file must be loaded prior to another. Sometimes this is because of
referential integrity, for example invoice records must be loaded before
their corresponding invoice_line_item records.
If the first transport fails catastrophically, there is not much point in
attempting the second transport, because it is guaranteed to fail as
well.
The following script performs two transports, but only performs the
second transport if the first transport runs to completion.
#!/bin/sh
sragent invoice.transport
status=$?
if [ $status = 2 ]; then
echo "Transport invoice is incomplete."
exit 2 # abort this script
fi
sragent invoice_line_item.transport
The second transport is only performed if the first transport completes. The
first transport may have rejected some rows (or even all rows), and because of referential integrity in your database, there will be rejects of the corresponding invoice_line_item records.
If you want to be more conservative, and only run the second transport if all rows transported properly (no rows were rejected), then you could change the if statement to if [ $status = 0 ]; then.
|