{"categories":[{"label":"Software Development","url":"https://skillfed.io/packages/category/software-development/13"},{"label":"Dynamic Content","url":"https://skillfed.io/packages/category/internet-www-http-dynamic-content/2"}],"enrichment":{"capability":"Query hierarchical tree structures in Django models using recursive common table expressions, with support for PostgreSQL, SQLite, MySQL, and MariaDB.","skillfed_tags":["django-orm","hierarchical-data","database-queries"],"use_cases":["Build category hierarchies or organizational charts where you need to fetch all ancestors or descendants of a node efficiently.","Implement breadcrumb navigation or tree views that require depth-first ordering and path information for each node.","Manage nested comment threads or forum structures with automatic depth calculation and sibling ordering.","Query large hierarchical datasets while avoiding N+1 query problems through recursive common table expressions.","Reorder sibling nodes in a tree without recalculating the entire structure using automatic position management."],"what_it_does":"django-tree-queries adds efficient tree querying to Django models using recursive common table expressions instead of materialized path or nested set approaches. It extends Django querysets with methods to add computed columns (tree_depth, tree_path, tree_ordering) and control sibling ordering. The package supports PostgreSQL, SQLite (3.8.3 or higher), MySQL (8.0 or higher), and MariaDB (10.2.2 or higher), with automatic optimization for simple queries that avoids creating intermediate rank tables.\n\nThe library enforces a minimal design: parent foreign keys must be named \"parent\", primary keys must be integer or UUID, and tree depth is correctly defined with root nodes at depth zero. It includes an abstract model class with built-in loop protection and a variant for automatic sibling position management. The approach trades configurability for simplicity and performance, avoiding the complexity and data redundancy of other tree libraries.","worth_installing":"Yes. The package is actively maintained, has no security vulnerabilities, installs with zero dependencies, and solves a real problem with a clean, opinionated design. It is suitable for any Django project needing hierarchical data queries on supported databases. The 50-level limit on MySQL/MariaDB is a documented trade-off; verify it fits your use case before committing."},"id":"django-tree-queries","links":{"html":"https://skillfed.io/packages/django-tree-queries","md":"https://skillfed.io/packages/django-tree-queries.md","pypi":"https://pypi.org/project/django-tree-queries/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2026-03-25","license_spdx":null,"license_treatment":"permissive","name":"django-tree-queries","python_support":"supports_current","summary":"Tree queries with explicit opt-in, without configurability"},"popularity":{"monthly_downloads":236026,"position":8991,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"0.24.0"}
