From 9068aca381169e865b89945e802d0020b9c1e2e3 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Sat, 29 Jul 2023 05:42:42 -0400 Subject: [PATCH] fix(ops): ensure that name attribute is always valid for `ops.SelfReference` --- ibis/expr/operations/relations.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ibis/expr/operations/relations.py b/ibis/expr/operations/relations.py index ba2ff9728ebb..c444a7d88d73 100644 --- a/ibis/expr/operations/relations.py +++ b/ibis/expr/operations/relations.py @@ -362,9 +362,11 @@ def schema(self): class SelfReference(TableNode): table = rlz.table - @property + @attribute.default def name(self) -> str: - return f"{self.table.name}_ref" + if (name := getattr(self.table, "name", None)) is not None: + return f"{name}_ref" + return util.gen_name("self_ref") @property def schema(self):