Is your feature request related to a problem? Please describe
In the current code, [run_id] is a simple INTEGER column, and parsers.py takes care of ensuring there is no [run_id] clash by getting the current maximum value and adding one. This is dangerous, as we sometimes delete [run_id]s, which means we could get clashes over time. This actually happened in a non-consequential way with reporting.py, which has it's current [run_id] to check as 245, but the current max [run_id] actually in [metadata].[run] is 222
Describe the solution you'd like
Changing the column to IDENTITY(1, 1) would solve this issue. An IDENTITY column guarantees that once a value is inserted into the table, it will never repeat (unless someone or something manually adjusts the index, but there's never any reason to and no one ever should).
In terms of actual implementation, this would slightly change the insertion script into [metadata].[run] and create_objects.sql, but otherwise no other code changes would be necessary. If this change is actually made, it would probably require a one time adjustment of the index to some arbitrary value like 250 or something to be safe
Describe alternatives you've considered
N/A
Additional context
N/A
Is your feature request related to a problem? Please describe
In the current code,
[run_id]is a simpleINTEGERcolumn, andparsers.pytakes care of ensuring there is no[run_id]clash by getting the current maximum value and adding one. This is dangerous, as we sometimes delete[run_id]s, which means we could get clashes over time. This actually happened in a non-consequential way withreporting.py, which has it's current[run_id]to check as245, but the current max[run_id]actually in[metadata].[run]is222Describe the solution you'd like
Changing the column to
IDENTITY(1, 1)would solve this issue. AnIDENTITYcolumn guarantees that once a value is inserted into the table, it will never repeat (unless someone or something manually adjusts the index, but there's never any reason to and no one ever should).In terms of actual implementation, this would slightly change the insertion script into
[metadata].[run]andcreate_objects.sql, but otherwise no other code changes would be necessary. If this change is actually made, it would probably require a one time adjustment of the index to some arbitrary value like250or something to be safeDescribe alternatives you've considered
N/A
Additional context
N/A