{"record":{"id":"8023dc86403a364f","repo":"pathwaycom/pathway","slug":"transformer-has-no-attribute-table-name","errorCode":null,"errorMessage":"transformer has no attribute `{table_name}`","messagePattern":"transformer has no attribute `(.+?)`","errorType":"exception","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"python/pathway/internals/graph_runner/row_transformer_operator_handler.py","lineNumber":237,"sourceCode":"            self.table_name\n        ]\n        return table_class_arg(self.row_reference, index)  # type: ignore[call-arg]\n\n    def pointer_from(self, *args, optional=False):\n        # XXX verify\n        return api.ref_scalar(*args, optional=optional)\n\n\n@dataclass\nclass TransformerReference:\n    \"\"\"Helper class to support `self.transformer.foo_class[id] access.\"\"\"\n\n    row_reference: RowReference\n\n    @trace.trace_user_frame\n    def __getattr__(self, table_name: str):\n        if table_name not in self.row_reference._class_arg.transformer.class_args:\n            raise AttributeError(f\"transformer has no attribute `{table_name}`\")\n        return TransformerReferenceIndexer(self.row_reference, table_name)\n\n\nclass RowReference:\n    \"\"\"Represents a context for particular row.\n\n    Holds all needed information allowing to translate reference to a column by name into\n    proper indexes understood by backend.\n    \"\"\"\n\n    id: api.Pointer\n\n    _context: api.Context\n    _class_arg: rt.ClassArgMeta\n    _mapping: TransformerColumnIndexMapping\n    _operator_id: int\n    \"\"\"Identifies an instance of the row transformer.\"\"\"\n","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/internals/graph_runner/row_transformer_operator_handler.py#L219-L255","documentation":"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`.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"# before\n@pw.table_transformer\ndef my_transformer(source):\n    return self.transformer.lookup[source.id]  # 'lookup' not declared\n\n# after\n@pw.table_transformer\n def my_transformer(source, lookup):\n    return self.transformer.lookup[source.id]","handlingStrategy":"validation","validationCode":"import inspect\n\ndef transformer_tables_declared(transformer_func) -> set[str]:\n    sig = inspect.signature(transformer_func)\n    return set(sig.parameters) - {\"self\"}\n\n# before calling: assert the accessed table is declared\nassert \"lookup\" in transformer_tables_declared(my_transformer), \"declare 'lookup' in the transformer signature\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["pathway","table-transformer","attribute-error","api-misuse"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}