pathwaycom/pathway · error · ValueError

{name!r} is a method name. It is discouraged to use it as a

Error message

{name!r} is a method name. It is discouraged to use it as a column name. If you really want to use it, use [{name!r}].

What it means

Raised by TableSlice.__getattr__ (the pw.this proxy) when an attribute access matches a Table method name. Pathway reserves method names on the this-proxy; to reference a column that shadows a method you must use item access (['name']) which bypasses __getattr__. Only 'id' is exempted.

Source

Thrown at python/pathway/internals/table_slice.py:71

    @overload
    def __getitem__(self, args: list[str | ColumnReference]) -> TableSlice: ...

    @trace_user_frame
    def __getitem__(
        self, arg: str | ColumnReference | list[str | ColumnReference]
    ) -> ColumnReference | TableSlice:
        if isinstance(arg, (ColumnReference, str)):
            return self._mapping[self._normalize(arg)]
        else:
            return TableSlice({self._normalize(k): self[k] for k in arg}, self._table)

    @trace_user_frame
    def __getattr__(self, name: str) -> ColumnReference:
        from pathway.internals import Table

        if hasattr(Table, name) and name != "id":
            raise ValueError(
                f"{name!r} is a method name. It is discouraged to use it as a column"
                + f" name. If you really want to use it, use [{name!r}]."
            )
        if name not in self._mapping:
            raise AttributeError(f"Column name {name!r} not found in {self!r}.")
        return self._mapping[name]

    @trace_user_frame
    @check_arg_types
    def without(self, *cols: str | ColumnReference) -> TableSlice:
        mapping = self._mapping.copy()
        for col in cols:
            colname = self._normalize(col)
            if colname not in mapping:
                raise KeyError(f"Column name {repr(colname)} not found in a {self}.")
            mapping.pop(colname)
        return TableSlice(mapping, self._table)

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Use item access: pw.this['filter'] or table['filter'] instead of pw.this.filter
  2. Prefer renaming such columns at ingestion: schema field named differently, or rename immediately after input
  3. Audit schemas for Table method names (hasattr(pw.Table, name)) and rename collisions
  4. Configure the connector to rename/skip those columns when reading

Example fix

# before
t2 = t.select(pw.this.filter)  # 'filter' is a Table method -> ValueError

# after
t2 = t.select(pw.this['filter'])
Defensive patterns

Strategy: validation

Validate before calling

import pathway as pw

def collides_with_method(name: str) -> bool:
    return hasattr(pw.Table, name) and name != 'id'

# use t[name] / pw.this[name] for any column where this is True

Type guard

def safe_attr_access(name: str) -> bool:
    import pathway as pw
    return not (hasattr(pw.Table, name) and name != 'id')

Try / catch

try:
    ref = getattr(pw.this, name)
except ValueError as e:
    if 'method name' in str(e):
        ref = pw.this[name]

Prevention

When it happens

Trigger: Accessing pw.this.filter, pw.this.concat, pw.this.rename, etc. where a column of that name exists — attribute access is interpreted as method-name collision and rejected; e.g. a column literally named 'filter' or 'update'.

Common situations: Schemas containing columns named after Table methods ('filter', 'select', 'join', 'sort', 'update'); loading CSVs/JSON with such header names; code generation that emits attribute-style column access.

Related errors


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