pathwaycom/pathway · error · AttributeError
transformer has no attribute `{table_name}`
Error message
transformer has no attribute `{table_name}` What it means
Raised by TransformerReference.__getattr__ when a row transformer accesses self.transformer.<name> but <name> is not among the transformer's class_args (the tables declared in the @pw.table_transformer decorator). It is an AttributeError thrown during trace building, before any data flows. The check is `table_name not in self.row_reference._class_arg.transformer.class_args`.
Source
Thrown at python/pathway/internals/graph_runner/row_transformer_operator_handler.py:237
self.table_name
]
return table_class_arg(self.row_reference, index) # type: ignore[call-arg]
def pointer_from(self, *args, optional=False):
# XXX verify
return api.ref_scalar(*args, optional=optional)
@dataclass
class TransformerReference:
"""Helper class to support `self.transformer.foo_class[id] access."""
row_reference: RowReference
@trace.trace_user_frame
def __getattr__(self, table_name: str):
if table_name not in self.row_reference._class_arg.transformer.class_args:
raise AttributeError(f"transformer has no attribute `{table_name}`")
return TransformerReferenceIndexer(self.row_reference, table_name)
class RowReference:
"""Represents a context for particular row.
Holds all needed information allowing to translate reference to a column by name into
proper indexes understood by backend.
"""
id: api.Pointer
_context: api.Context
_class_arg: rt.ClassArgMeta
_mapping: TransformerColumnIndexMapping
_operator_id: int
"""Identifies an instance of the row transformer."""
View on GitHub (pinned to fa2f74a464)
Solutions
- Add the missing table name to the @pw.table_transformer decorator's class-argument list so class_args contains it
- Fix the name in self.transformer.<name> to match an already-declared table argument
- Check for typos between the decorator declaration and the transformer body
Example fix
# before
@pw.table_transformer
def my_transformer(source):
return self.transformer.lookup[source.id] # 'lookup' not declared
# after
@pw.table_transformer
def my_transformer(source, lookup):
return self.transformer.lookup[source.id] Defensive patterns
Strategy: validation
Validate before calling
import inspect
def transformer_tables_declared(transformer_func) -> set[str]:
sig = inspect.signature(transformer_func)
return set(sig.parameters) - {"self"}
# before calling: assert the accessed table is declared
assert "lookup" in transformer_tables_declared(my_transformer), "declare 'lookup' in the transformer signature" Prevention
- Keep the transformer signature and self.transformer.<name> uses in sync; rename both together
- Write a unit test that calls the transformer once with tiny inputs to fail fast at build time
When it happens
Trigger: Calling a @pw.table_transformer-decorated function whose body does self.transformer.some_table[...] where 'some_table' was not listed in the decorator's class arguments (e.g. decorator declares input_tables=['t'] but the body uses self.transformer.other).
Common situations: Renaming a transformer input table in the decorator but not in the body; copy-pasting a transformer implementation and forgetting to update the decorator; typos in the table name.
Related errors
- `{self.name}` has no attribute `{name}`
- Join received extra kwargs. You probably want to use TableLi
- synchronization_group can only be set once
- Duplicate expression value given for {name}
- Cannot use expression as boolean.
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/8023dc86403a364f.
Report an issue: GitHub.