pathwaycom/pathway · error · AttributeError

`{self.name}` has no attribute `{name}`

Error message

`{self.name}` has no attribute `{name}`

What it means

RowReference.__getattr__ wraps attribute lookup on a row inside a transformer: if the attribute is neither a column declared in the transformer's class arg schema (_is_attribute) nor a class-level property (_get_class_property), it re-raises AttributeError with '`{self.name}` has no attribute `{name}`'. The original exception is masked, so only the friendlier message is shown.

Source

Thrown at python/pathway/internals/graph_runner/row_transformer_operator_handler.py:290

        return TransformerReference(self)

    def _with_class_arg(self, class_arg: rt.ClassArgMeta, id: api.Pointer):
        return RowReference(
            class_arg, self._context, self._mapping, self._operator_id, id
        )

    @trace.trace_user_frame
    def __getattr__(self, name: str):
        try:
            if not self._class_arg._is_attribute(name):
                return self._non_attribute_property(name)

            table_index = self._class_arg._index
            column_index = self._mapping.get(self._operator_id, table_index, name)
            attribute = self._class_arg._get_attribute(name)
        except AttributeError:
            # Reraise with better message
            raise AttributeError(f"`{self.name}` has no attribute `{name}`")

        if attribute.is_method:

            def func(*args):
                return self._context.raising_get(column_index, self.id, *args)

            return func
        else:
            return self._context.raising_get(column_index, self.id)

    def _non_attribute_property(self, name: str) -> Any:
        attr = self._class_arg._get_class_property(name)
        if hasattr(attr, "__get__"):
            return attr.__get__(self)
        else:
            return attr

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Add the missing attribute to the schema/class used by that row's table
  2. Correct the attribute name to match an existing schema column (check for typos)
  3. If the attribute is derived, expose it as a class property so _get_class_property finds it

Example fix

# before
class InputSchema(pw.Schema):
    value: int

def transform_row(...)...
    return self.value * 2, self.val  # 'val' does not exist

# after
class InputSchema(pw.Schema):
    value: int

    # use the correct column name
    return self.value * 2, self.value
Defensive patterns

Strategy: type-guard

Validate before calling

cols = set(table.schema.column_names()) if hasattr(table, 'schema') else set(table._columns)
assert col_name in cols, f"{col_name!r} not in {sorted(cols)}"

Type guard

def has_column(table, name: str) -> bool:
    schema = getattr(table, 'schema', None)
    names = schema.column_names() if schema is not None else table._columns.keys()
    return name in names

Prevention

When it happens

Trigger: Inside a row transformer, accessing self.<col> or ctx.<col> where <col> is not a field of the schema/class associated with the row; also triggered when the underlying _mapping.get lookup itself raises AttributeError for a stale operator id.

Common situations: Schema evolution: column renamed or removed from the input schema but transformer code still references it; typos in column names; referencing a column of a different table than the one the row belongs to.

Related errors


AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15). Data as JSON: /api/errors/ea9bd29c93687146. Report an issue: GitHub.