-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HJ-319 Add DBCache model and table #5613
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
fides Run #11551
Run Properties:
|
Project |
fides
|
Branch Review |
refs/pull/5613/merge
|
Run status |
Passed #11551
|
Run duration | 00m 50s |
Commit |
614d892fae ℹ️: Merge 1c41a11b5d6f95ec0778a28e8f5c7d485bdf05f3 into 70272d1b1ff9a4c1fc0474ebe9b4...
|
Committer | erosselli |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
0
|
Pending |
0
|
Skipped |
0
|
Passing |
4
|
Upgrade your plan to view test results. | |
View all changes introduced in this branch ↗︎ |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5613 +/- ##
==========================================
+ Coverage 87.15% 87.17% +0.01%
==========================================
Files 387 388 +1
Lines 23900 23931 +31
Branches 2585 2586 +1
==========================================
+ Hits 20830 20861 +31
Misses 2512 2512
Partials 558 558 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks solid to me! just a nit on the sqlalchemy representation of the composite index 👍
edit: just a note to keep an eye on the downrev in your migration, i know there's at least one other in-flight PR that touches migrations
src/fides/api/models/db_cache.py
Outdated
namespace = Column( | ||
String, nullable=False, index=True | ||
) # Add a namespace since the same cache key could technically be used for different contexts | ||
cache_key = Column(String, nullable=False, index=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm - i'm not sure how much it matters, but i think for a composite index (which this is, right?) it's generally specified a bit differently?
and we have some examples in our code base, e.g. here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah I forgot to specify the composite index on the model definition, I just added it in the migration 🤦♀️ I'll add it.
I did add index=True just to namespace thinking of queries like "Let's remove all entries for a namespace" , that don't have a specific cache_key but maybe the composite index still works for those kinds of queries? I'm a bit rusty on the specifics of composite indexes 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heh, i'm not really an expert either. from my general understanding, i don't think the composite index would work well specifically for that use case - but i haven't validated that assumption at all.
i was aware of your intention with the two indexes there, and i didn't really question it - so i'd say it's fine to keep that in place! 👍
String, nullable=False, index=True | ||
) # Add a namespace since the same cache key could technically be used for different contexts | ||
cache_key = Column(String, nullable=False, index=True) | ||
cache_value = Column(BYTEA, nullable=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, i hope this works well and i wasn't silly to suggest a byte column :)
fides Run #11553
Run Properties:
|
Project |
fides
|
Branch Review |
main
|
Run status |
Passed #11553
|
Run duration | 00m 47s |
Commit |
ebbd5d8851: HJ-319 Add DBCache model and table (#5613)
|
Committer | erosselli |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
0
|
Pending |
0
|
Skipped |
0
|
Passing |
4
|
Upgrade your plan to view test results. | |
View all changes introduced in this branch ↗︎ |
Implements part of HJ-319
Description Of Changes
Adds a
DBCache
model and table to be used for persistent caching. The table has thenamespace
andcache_key
columns that uniquely determine a row, and the columncache_value
is used for storing an arbitrary value. For now we'll only use this for the list privacy experiences endpoint, but in the future it should be easy to add other things as well.Code Changes
DBCache
model and its corresponding migrationSteps to Confirm
Pre-Merge Checklist
CHANGELOG.md
updatedmain
downgrade()
migration is correct and works