How to create breadcrumbs in multi-level categories?

5a3387dd42243381834077.png

To get this result

0-LEVEL-2 -> 1-LEVEL -> 2ND LEVEL

if the id = 11

Can it be done with one query?
June 10th 19 at 14:56
2 answers
June 10th 19 at 14:58
Solution
You can, if you're using MPTT / Nested sets
June 10th 19 at 15:00
Solution
A few options:
- recursively call multiple queries to the database
to use the database features, for example, with recursive in postgresql
- if categories a bit, then select all and at the level of python to collect the chain
well, plus from
- use a different structure for storage hierarchies

Find more questions by tags SQLAlchemyFlaskPython