Query Utils#

backend.app.utils.query_utils.get_all_voc_subclass_ancestor_ids_by_voc_subclass_id(voc_subclass_id, session) list[int][source]#

Retrieve all ancestor IDs for a given VocSubclass ID using a recursive CTE.

Parameters:
  • voc_subclass_id (int) – The ID of the VocSubclass for which to find ancestors.

  • session (sqlalchemy.orm.session.Session) – SQLAlchemy session used to execute the query.

Returns:

A list of ancestor IDs of the specified VocSubclass, including all direct and indirect parents.

Return type:

list[int]