-
Notifications
You must be signed in to change notification settings - Fork 33
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
Dynamic query #69
Comments
How should it look?
|
My idea looks like this. The current drill down tree returns a python dictionary, but if it can return a query set like how it list ancestor nodes, it will only read all data from the database when the data is finally needed, which not only makes The api looks more user-friendly and avoids unnecessary read operations. You can also use the api of the query set in sqlalchemy instead of writing a python dictionary-based query |
This may lead to multiple queries in some scenarios, but the performance is much better than reading all grandchildren nodes. Of course, it is possible to query directly using the left and right fields, but I will be happy if it is in node's methods. |
Could you give an example of how this should look? What should the function return? |
Allright, in current version, we use Drilldown like this:
So what it return is a python dict and the nodes are already listed. How path to root work:
Path to root return a sqlalchemy query set, so if you finally need the nodes, you should first call |
I mean Query object in sqlalchemy, query set is the orm query object in Django |
So maybe there should be a new method for mptt node to get a query object which includes all children nodes, and drilldown should be kept to get the tree structure. |
I will think about how to do it |
Drilldowntree return a list but not a query, returning a query can make the query easier
The text was updated successfully, but these errors were encountered: