sql: Add support for releases published as part of a record #119
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: #110
I have updated:
tmp_release_summary
to select the releases, which is then used by all the other create table statementsparties_summary
, to lookup the correct release fromdata.data
(which stores the parent record)The following always include
data.data
directly, even for a release type ofrecord
, so I haven't added a lookup for this new release type:tender_summary_with_data
awards_summary
contracts_summary
release_summary_with_data
For the
release_type
I have usedreleases_within_record
instead ofreleasesWithinRecord
for consistency withcompiled_release
.For the
id
, I have used:1_000_000_000 * record.id + release_index
. We may want to tweak this, or do something completely different. I have chosen the multiplier because its roughly the square root of the bigint maximum. Checking the kingfisher server, the largest record id is ~24_000_000
, so I think this works for the foreseeable future (although that would be good to check with someone who knows the data better).Releases are assumed to be linked releases (and ignored) if the
id
key is not present.