CD2 and Canvas Live Events format entity ids differently: are there any plans to address the discrepancy?

Jump to solution
pgo586
Community Contributor

While I was originally happy to see that the long ids in Canvas Data 1 (e.g. of the type 64750000000043215 ) had been removed in Canvas Data 2, it eventually came time for me to re-write all the queries we have in place for various uses. These queries mostly join Canvas Live Events with 1 or more Canvas Data tables.  With Canvas Data 1 this was relatively easy to do, as the long ids were present in both CD1 and also Canvas Live Events. However, the migration to CD2 therefore presents the additional challenge that the long ids remain in Canvas Live Events.  
While it's not impossible to convert one to match the other (just for the purposes of running queries), it is definitely not convenient. In addition, it would make sense for Instructure to use the same convention in both data sources, of course. Are there any plans to do this? 

0 Likes
1 Solution

Unfortunately, I am not aware of any short-term plans to change how Live Events produces entity identifiers.

When designing CD 2, we wanted to represent identifiers in a way that is closest to the source. Internally, local IDs are used for references within a root account (e.g. courses) and global IDs are used for references to outside one's root account (e.g. some of the users). Specifically, users who live in one root account but have a replica in another root account have a global ID in CD 2, whereas normal users (users in their home root account) have a local ID. As a result, it is possible to differentiate local and replicated users in CD 2, which was not possible in CD 1.

There is a one-to-one mapping between global IDs and local IDs: global IDs are constructed from the so-called shard ID and the local ID. Among other places, the shard ID is shown in the Canvas Site Admin interface. The shard ID is written in the high decimal digits, and the local ID is in the low decimal digits of the global ID. The recommended practice to join tables that use different types of identifiers is to either drop the shard ID component of a global ID (for single-account institutions), or augment the local ID with the shard ID (for multi-account institutions). We use these same transformations internally for combining data. In particular, some of our data stores use a pair of shard ID and local ID for each record.

View solution in original post