diff --git a/posthog/hogql/database/database.py b/posthog/hogql/database/database.py index 6909211070e59..9ce4a502713dd 100644 --- a/posthog/hogql/database/database.py +++ b/posthog/hogql/database/database.py @@ -316,7 +316,7 @@ class _SerializedFieldBase(TypedDict): class SerializedField(_SerializedFieldBase, total=False): fields: List[str] table: str - chain: List[str] + chain: List[str | int] def serialize_database(context: HogQLContext) -> Dict[str, List[SerializedField]]: diff --git a/posthog/hogql/database/models.py b/posthog/hogql/database/models.py index 797e4fcf94b46..46e0ba2129791 100644 --- a/posthog/hogql/database/models.py +++ b/posthog/hogql/database/models.py @@ -76,7 +76,8 @@ def has_field(self, name: str | int) -> bool: return str(name) in self.fields def get_field(self, name: str | int) -> FieldOrTable: - if self.has_field(str(name)): + name = str(name) + if self.has_field(name): return self.fields[name] raise Exception(f'Field "{name}" not found on table {self.__class__.__name__}')