diff --git a/posthog/hogql/ast.py b/posthog/hogql/ast.py index f0af01ea430eb..793d40e537d30 100644 --- a/posthog/hogql/ast.py +++ b/posthog/hogql/ast.py @@ -309,7 +309,7 @@ class AsteriskType(Type): @dataclass(kw_only=True) class FieldTraverserType(Type): - chain: List[str | int] | List[str] + chain: List[str | int] table_type: TableOrSelectType diff --git a/posthog/hogql/database/models.py b/posthog/hogql/database/models.py index d2da7868a7f9c..9dd75b7be4bfe 100644 --- a/posthog/hogql/database/models.py +++ b/posthog/hogql/database/models.py @@ -65,15 +65,15 @@ class ExpressionField(DatabaseField): class FieldTraverser(FieldOrTable): model_config = ConfigDict(extra="forbid") - chain: List[str] + chain: List[str | int] class Table(FieldOrTable): fields: Dict[str, FieldOrTable] model_config = ConfigDict(extra="forbid") - def has_field(self, name: str) -> bool: - return name in self.fields + def has_field(self, name: str | int) -> bool: + return str(name) in self.fields def get_field(self, name: str) -> FieldOrTable: if self.has_field(name):