NodeData class

class NodeData(id=None, parent=None, position=None, properties=None)

Immutable data-holding object which represents tree node data. Its attributes are identical to the columns in the nodes table (see Database Model).

Since the object is immutable, you must retrieve a new instance of the same node using libtree.core.query.get_node() to get updated values.

To manipulate the values, you must use one of the following functions:

Most libtree functions need a database ID in order to know on which data they should operate, but also accept Node objects to make handling with them easier.

All parameters are optional and default to None.

  • id (int) – ID of the node as returned from the database
  • parent (Node or int) – Reference to a parent node
  • position (int) – Position in between siblings (see Positioning functions)
  • properties (dict) – Inheritable key/value pairs (see Property functions)

Node ID


Parent ID


Position in between its siblings


Node properties


Return dictionary containing all values of the object.