Add partial cache support to inject-links-pid #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "msz/query-rse-group:more-cache-and-tweaks"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The
--record-cacheargument ininject_links_pidwas available but the cache was never used by the command. Given that this command normally requests records to be looked up from the Pool by class (not by single PID) it is not obvious what a full implementation of cache should look like (commands which fetch one PID at a time can consult cache first and API only if not cached).This PR adds partial, but hopefully intuitive cache handling. If the option
--only-from-cacheis given, then no requests to the API will be made; instead, all cached records (and cached records only) will be scanned, filtered by class name (if requested), checked whether they link the given object, and injected.No writing to cache is done. If the
--only-from-cacheoption is not used, the cache is ignored (as previously).This "inject from cache" was motivated by the following use case: extending Person records with their Project roles. This can be done as follows: Fetch project records, inline
associated_with::roles, save in cache, then run inject-links-pid --only-from-cache to inject projects with roles inlined (inline-records currently can't deal with nested properties).Note: This PR also bundled smaller tweaks in
pyproject.tomlwhich have since been cherry-picked by @mih (thanks!). I rebased & force-pushed the branch to get rid of (now empty) commits.8079dbd9feto16a7b74f8216a7b74f82tofb5b766334Add partial cache support toto Add partial cache support toinject-links-pid, small pyproject updateinject-links-pidView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.