Skip to content

Commit

Permalink
more types
Browse files Browse the repository at this point in the history
  • Loading branch information
EDsCODE committed Mar 27, 2024
1 parent 9bac19e commit 1973539
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion posthog/hogql/database/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]:
Expand Down
3 changes: 2 additions & 1 deletion posthog/hogql/database/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__}')

Expand Down

0 comments on commit 1973539

Please sign in to comment.