{"record":{"id":"b0d9076676a358cc","repo":"pathwaycom/pathway","slug":"column-name-name-r-not-found-in-self-r","errorCode":null,"errorMessage":"Column name {name!r} not found in {self!r}.","messagePattern":"Column name (.+?) not found in (.+?)\\.","errorType":"exception","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"python/pathway/internals/table_slice.py","lineNumber":76,"sourceCode":"    def __getitem__(\n        self, arg: str | ColumnReference | list[str | ColumnReference]\n    ) -> ColumnReference | TableSlice:\n        if isinstance(arg, (ColumnReference, str)):\n            return self._mapping[self._normalize(arg)]\n        else:\n            return TableSlice({self._normalize(k): self[k] for k in arg}, self._table)\n\n    @trace_user_frame\n    def __getattr__(self, name: str) -> ColumnReference:\n        from pathway.internals import Table\n\n        if hasattr(Table, name) and name != \"id\":\n            raise ValueError(\n                f\"{name!r} is a method name. It is discouraged to use it as a column\"\n                + f\" name. If you really want to use it, use [{name!r}].\"\n            )\n        if name not in self._mapping:\n            raise AttributeError(f\"Column name {name!r} not found in {self!r}.\")\n        return self._mapping[name]\n\n    @trace_user_frame\n    @check_arg_types\n    def without(self, *cols: str | ColumnReference) -> TableSlice:\n        mapping = self._mapping.copy()\n        for col in cols:\n            colname = self._normalize(col)\n            if colname not in mapping:\n                raise KeyError(f\"Column name {repr(colname)} not found in a {self}.\")\n            mapping.pop(colname)\n        return TableSlice(mapping, self._table)\n\n    @trace_user_frame\n    @check_arg_types\n    def rename(\n        self,\n        rename_dict: dict[str | ColumnReference, str | ColumnReference],","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/internals/table_slice.py#L58-L94","documentation":"Raised by TableSlice.__getattr__ when the accessed attribute is neither a Table method name nor a column present in the slice's mapping. It is a plain AttributeError raised from the pw.this proxy, meaning the requested column simply does not exist on that table/slice.","triggerScenarios":"pw.this.typo_col inside select/filter/with_columns; accessing a column dropped by an earlier select/without; using a slice that was constructed from a subset of columns.","commonSituations":"Typos in column names; schema drift after connector changes; referencing columns removed earlier in the chain; using the wrong pw.this from another table in a multi-table pipeline.","solutions":["List available columns: print(t.column_names()) and fix the name","Check whether an earlier select/without removed the column; reorder or re-add it","Ensure you use the correct table's proxy (pw.this vs pw.left/pw.right in joins)","In tests, assert required columns exist before building expressions: assert 'col' in t.keys()"],"exampleFix":"# before\nt2 = t.select(pw.this.usr_name)  # column is 'user_name'\n\n# after\nt2 = t.select(pw.this.user_name)","handlingStrategy":"validation","validationCode":"def column_exists(t, name: str) -> bool:\n    return name in t.keys()\n\n# assert column_exists(t, 'user_name') before building expressions","typeGuard":"def has_columns(t, *names) -> bool:\n    return all(n in t.keys() for n in names)","tryCatchPattern":"try:\n    ref = getattr(pw.this, name)\nexcept AttributeError as e:\n    if 'not found' in str(e):\n        raise KeyError(f'{name} not in {t.column_names()}') from e","preventionTips":["Assert required columns exist at pipeline setup","Track columns through select/without chains","Use pw.left/pw.right (not pw.this) inside join selects"],"tags":["pathway","column-name","table-slice","attributeerror"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}