From e7370dff9fb1f971df6833075c9aca2bbe90d2c1 Mon Sep 17 00:00:00 2001 From: Petru Conduraru Date: Sun, 30 Aug 2026 15:17:36 +0300 Subject: [PATCH] fix(sql): recognise derived attributes in sqlite_entity.__getattr__ get_attribute_category() returns 3 for a derived attribute, but sqlite_entity.__getattr__() only branched on FORWARD (1) and INVERSE (2), so any derived attribute (e.g. IfcSIUnit.Dimensions) fell through to the final AttributeError instead of returning None, which is what SQLite-linked files are documented to do since derived attributes are not computed for them. Mirrors the DERIVED handling already present in entity_instance.py's __getattr__. --- src/ifcopenshell-python/ifcopenshell/sql.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ifcopenshell-python/ifcopenshell/sql.py b/src/ifcopenshell-python/ifcopenshell/sql.py index 2e57f6dc81..2ae2824b32 100644 --- a/src/ifcopenshell-python/ifcopenshell/sql.py +++ b/src/ifcopenshell-python/ifcopenshell/sql.py @@ -385,8 +385,12 @@ class sqlite_entity: # print("*" * 100) # print("GETATTR", self.sqlite_wrapper.id, self.sqlite_wrapper.ifc_class, name) - INVALID, FORWARD, INVERSE = range(3) + INVALID, FORWARD, INVERSE, DERIVED = range(4) attr_cat = self.wrapped_data.get_attribute_category(name) + if attr_cat == DERIVED: + # Derived attributes aren't stored or computed for SQLite-linked + # files, so callers must treat None as "not available" here. + return None if attr_cat == FORWARD: if self.sqlite_wrapper.attribute_cache: # print(self.sqlite_wrapper.ifc_class)