Canvas Data 2 - Incremental "until" to maintain referential integrity

KeithSmith_au
Community Contributor

In the API specification for using incremental queries, the "until" parameter (only used with "since" has the following explanation:

until
string <date-time>

End timestamp (in UTC); only those records are returned that have not been changed after the specified date and time. If omitted (recommended), defaults to the commit time of the latest record.

 

I am not sure that I agree with the recommendation to always omit this.  If attempting to create an updated set of tables with referential integrity, it is important to ensure that all the tables are fetched to the same commit time. If running a series of incremental queries, there is a risk (albeit possible small) that some tables may be fetched prior to an update / refresh, and others after.  This risks a referential integrity issue with foreign keys.

I would have thought that the better practice would be to run a single incremental query with a since and omitted "until" date.  This will then return am "until" value which can be used as the "until" timestamp on all other table queries.

When "until" is specified on the input, the result returned for "until" matches the input.  For this to work, I need to know for sure (and I believe it to the the case) that the "until" value returned when an unbounded input is supplied is not the latest commit timestamp for the table, but the timestamp for the latest commit across all tables (i.e. the timestamp of the updated CD2 set).

0 Likes