Skip to content
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

Avoid repetitive nodegroup queries by using ORM to join Tile to Nodegroup #11808

Open
jacobtylerwalls opened this issue Feb 21, 2025 · 0 comments · May be fixed by #11809
Open

Avoid repetitive nodegroup queries by using ORM to join Tile to Nodegroup #11808

jacobtylerwalls opened this issue Feb 21, 2025 · 0 comments · May be fixed by #11809

Comments

@jacobtylerwalls
Copy link
Member

jacobtylerwalls commented Feb 21, 2025

Background
The foreign key from TileModel -> NodeGroup was removed in v8 (under development) to support graph versioning, specifically so that graphs could migrate away to new versions while leaving tile data behind.

A property was added to add compatibility with .nodegroup calls, but unlike a Django model field which caches when you access it, or lets you select_related() to avoid the query in the first place, in Lingo we're seeing avoidable queries on every access.

See discussion.

Proposal
One of the goodies in Django 5.2 is that an API for expressing joins without foreign keys was made more public. See the section on ForeignObject. It's newly documented but has been stable for many versions.

I have a little proof of concept that lets us restore the prior functionality for things like:

.nodegroup = 
.filter(nodegroup=
.select_related("nodegroup")

etc. I can PR it so we can take a decision about it. The performance is one aspect and then there's avoiding a breaking change if we can.

This will also help with writing arches applications compatible with both 7.6 and 8.0.

cc/ @chrabyrd @chiatt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 👀 In Review
Development

Successfully merging a pull request may close this issue.

1 participant