pathwaycom/pathway · error · AttributeError
Column of type {dtypes[0]} has no attribute {expression._nam
Error message
Column of type {dtypes[0]} has no attribute {expression._name}. What it means
For a method-call expression (attribute access like .dt, .str, Json accessors, custom method mappings), the evaluator resolves a handler from the actual argument dtypes via expression.get_function(dtypes). If no method is registered for that dtype under the requested attribute name, it raises AttributeError mirroring python semantics: the column's type has no such attribute.
Source
Thrown at python/pathway/internals/graph_runner/expression_evaluator.py:782
def eval_method_call(
self,
expression: expr.MethodCallExpression,
eval_state: RowwiseEvalState | None = None,
):
dtypes = tuple([arg._dtype for arg in expression._args])
if (dtypes_and_handler := expression.get_function(dtypes)) is not None:
new_dtypes, _, handler = dtypes_and_handler
expressions = [
self.eval_expression(
expr.CastExpression(dtype, arg),
eval_state=eval_state,
)
for dtype, arg in zip(new_dtypes, expression._args)
]
return handler(*expressions)
raise AttributeError(
f"Column of type {dtypes[0]} has no attribute {expression._name}."
)
def eval_unwrap(
self,
expression: expr.UnwrapExpression,
eval_state: RowwiseEvalState | None = None,
):
val = self.eval_expression(expression._expr, eval_state=eval_state)
return api.Expression.unwrap(val)
def eval_fill_error(
self,
expression: expr.FillErrorExpression,
eval_state: RowwiseEvalState | None = None,
):
dtype = expression._dtype
ret = self.eval_expression(View on GitHub (pinned to fa2f74a464)
Solutions
- Fix the dtype first: parse strings with dt.strptime() into DATE_TIME_UTC/NAIVE before using .dt methods, or cast the column to the type the namespace requires
- Unwrap Optional: apply .unwrap() (or fill errors) so a Optional[DateTimeUtc] becomes DateTimeUtc before attribute access
- Check the message's dtype against the method's supported types in the docs; correct the method name if it is a typo
Example fix
// before
formatted = pw.this.raw.dt.strftime('%Y-%m') # raw is str
// after
parsed = pw.this.raw.dt.strptime('%Y-%m-%d %H:%M:%S%z')
formatted = parsed.dt.strftime('%Y-%m') Defensive patterns
Strategy: type-guard
Validate before calling
def dtype_supports_namespace(dtype, namespace: str) -> bool:
ns_requires = {"dt": {"DATE_TIME_NAIVE", "DATE_TIME_UTC"}, "str": {"STRING"}}
return str(dtype) in ns_requires.get(namespace, set()) Type guard
from pathway.internals import dtype as dt
def is_datetime_dtype(dtype) -> bool:
return dtype in (dt.DATE_TIME_UTC, dt.DATE_TIME_NAIVE) Try / catch
try:
run()
except AttributeError as e:
if "has no attribute" in str(e):
# parse/cast the column to the dtype the method requires, then retry
... Prevention
- strptime into a datetime dtype before using .dt methods
- Unwrap Optional columns before attribute access
- Add a schema assertion right after ingestion that key columns have the expected dtypes
When it happens
Trigger: Calling .dt methods on a str or int column (pw.this.col.dt.strftime(...) where col is not a datetime); .str.contains on an int column; Json accessors on a non-Json column; .dt on DateTimeNaive where only DateTimeUtc supports the method; typo in the method name.
Common situations: Schema drift: a column that used to parse as DateTimeUtc now arrives as str, breaking chained .dt calls; Optional-wrapped datetimes losing the namespace; copying example code against a differently-typed table.
Related errors
- Pathway does not support using binary operator {expression._
- Pathway doesn't support casting {source_type} to {target_typ
- Pathway doesn't support converting {source_type} to {target_
- Cannot flatten column of type {dtype}.
- Unsupported type {input_type}, use pw.DATE_TIME_UTC or pw.DA
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/2c4f7278fcda247e.
Report an issue: GitHub.