Enable huge 'select' statements #10
Closed
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.
Summary
Use temp-tables to enable us to pass in a million IDs for a given 'select' statement
In postgres, there is some limit to how long you can make a
select * from table where id in (1,2,3,4,5.....)
statement.But at Cedar, we sometimes have really big files which come from third parties. And such a file may contain a list of millions of IDs. And we may want to select our data out of the database, based on these millions of incoming IDs. This feature enables us to do this.
There are lots of existing helper methods that allow us to implement this. The general approach is:
Test Plan
How can reviewers test your change manually?
Tinker with the automated tests that are part of this PR
What automated tests did you add? If none, please state why.
I wanted to rely just on the existing tests, since I viewed this change as being simply about implementation details. Then I realized that my first attempt was actually broken in a way that was not reflected by the tests. The problem is that you can get extra records back, if your
filter_data
contains duplicates. So I had to write tests that illustrated this potential problem.Security Impact
Please answer the questions below about your PR.
If yes, please explain and add
cedar-team/security
as reviewers.Add/modify authentication, authorization, encryption, or HTTP headers?
No
Add/modify any PII or PHI data fields?
No
Add new third parties the app interacts with (e.g., Nordis/Stripe)?
No
Ask patients to enter a new kind of data, (e.g. insurance capture)?
No
Impact any of the other [Security Engineering Practices]
No