pathwaycom/pathway · error · AttributeError
Column of type {dtypes[0].typehint} has no attribute {expres
Error message
Column of type {dtypes[0].typehint} has no attribute {expression._name}{with_arguments}. What it means
AttributeError raised by the type interpreter when a method call (e.g. column.str_to_upper(), column.dt_floor(), .dt_day(), ...) has no registered handler for the operand's dtype. Pathway dispatches methods on the column's static dtype; if no overload matches the argument types, the method does not exist for that type.
Source
Thrown at python/pathway/internals/type_interpreter.py:609
def eval_method_call(
self,
expression: expr.MethodCallExpression,
state: TypeInterpreterState | None = None,
**kwargs,
) -> expr.MethodCallExpression:
expression = super().eval_method_call(expression, state=state, **kwargs)
dtypes = tuple([arg._dtype for arg in expression._args])
if (dtypes_and_handler := expression.get_function(dtypes)) is not None:
return _wrap(expression, dt.wrap(dtypes_and_handler[1]))
if len(dtypes) > 0:
with_arguments = (
f" with arguments of type {[dtype.typehint for dtype in dtypes[1:]]}"
)
else:
with_arguments = ""
raise AttributeError(
f"Column of type {dtypes[0].typehint} has no attribute {expression._name}{with_arguments}."
)
def eval_unwrap(
self,
expression: expr.UnwrapExpression,
state: TypeInterpreterState | None = None,
**kwargs,
) -> expr.UnwrapExpression:
expression = super().eval_unwrap(expression, state=state, **kwargs)
dtype = expression._expr._dtype
self._check_for_disallowed_types("pathway.unwrap", dtype)
return _wrap(expression, dt.unoptionalize(dtype))
def eval_fill_error(
self,
expression: expr.FillErrorExpression,
state: TypeInterpreterState | None = None,View on GitHub (pinned to fa2f74a464)
Solutions
- Recheck the column dtype (print table.schema) and call a method valid for that type
- Convert types first: pw.this.col.astype(int), pw.this.col.dt_parse() / str_to_datetime before datetime ops
- Unwrap Optional columns with pw.unwrap if the method requires non-optional input
- Check the Pathway docs for the method's accepted dtypes and argument signature for your version
Example fix
// before res = t.select(hour=t.ts.dt_hour()) # t.ts is str from CSV // after t = t.with_columns(ts=pw.this.ts.dt_parse()) res = t.select(hour=t.ts.dt_hour())
Defensive patterns
Strategy: type-guard
Validate before calling
import pathway as pw
def check_method_supported(col, method_name: str, *arg_cols) -> bool:
dtypes = tuple([col._column.dtype] + [c._column.dtype for c in arg_cols])
from pathway.internals import expressions as expr # debug helper
return dtypes # compare against pathway expression method tables in tests Type guard
import pathway as pw
def is_str_col(col) -> bool:
d = col._column.dtype
return d.equivalent_to(pw.string) or d.equivalent_to(pw.Optional[pw.string])
def is_datetime_col(col) -> bool:
return col._column.dtype.equivalent_to(pw.DateTimeNaive) or col._column.dtype.equivalent_to(pw.DateTimeUtc) Try / catch
try:
res = t.select(h=t.ts.dt_hour())
except AttributeError as e:
if 'has no attribute' in str(e):
t = t.with_columns(ts=pw.this.ts.dt_parse())
res = t.select(h=t.ts.dt_hour())
else:
raise Prevention
- Verify dtypes with table.schema before applying dtype-specific methods
- Parse string timestamps with dt_parse()/str_to_datetime() before .dt_* calls
- Pin the Pathway version and re-check method availability after upgrades
When it happens
Trigger: Calling string methods on an int column (t.num.str_to_upper()), datetime methods on a string column (t.s.dt_hour()), or passing argument types the method does not accept (e.g. t.col.dt_floor(t.other_str_col)). Any MethodCallExpression whose (arg dtypes) tuple has no entry in the method's function table.
Common situations: CSV connector read a date column as str and developer calls .dt_* methods; column is Optional[str] or Optional[int] and the method only accepts the non-optional type; version upgrade removed/renamed a method; wrong argument type to a dt/str method.
Related errors
- Incompatible types in a join condition. The types are: {eval
- Object in {expression!r} has to be a JSON or sequence.
- Index in {expression!r} has to be an int.
- Index n
- Index {expression._const_index} out of range for a tuple of
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/6e4cad300134d9f7.
Report an issue: GitHub.