Skip to content

Commit

Permalink
fix(data-models): Typing fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfarias committed Aug 12, 2024
1 parent f74781d commit 6e11727
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions posthog/warehouse/models/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def get_hogql_query(query: str, team: Team) -> ast.SelectQuery | ast.SelectUnion
from posthog.hogql.parser import parse_select

parsed_query = parse_select(query)
return parsed_query # type: ignore
return parsed_query


def get_parents_from_model_query(model_query: str, team: Team):
Expand Down Expand Up @@ -191,9 +191,7 @@ class DAG:
"""


class DataWarehouseModelPathManager(models.Manager):
model: "DataWarehouseModelPath"

class DataWarehouseModelPathManager(models.Manager["DataWarehouseModelPath"]):
def create_from_saved_query_instance(self, saved_query: DataWarehouseSavedQuery) -> "list[DataWarehouseModelPath]":
"""Create a new model path from a new `DataWarehouseSavedQuery`.
Expand Down Expand Up @@ -332,7 +330,9 @@ def get_dag(self, team: Team):
* Certain paths can be redundant and could be excluded from the query.
"""
edges = set()
nodes = set()
nodes: set[Node] = set()
node_type: NodeType
node_id: NodeId

for model_path in self.filter(team=team).select_related("saved_query", "table").all():
if model_path.table is not None:
Expand All @@ -346,7 +346,7 @@ def get_dag(self, team: Team):
try:
next_node_id = model_path.path[index + 1]
except IndexError:
node = (node_id, node_type)
node: tuple[NodeId, NodeType] = (node_id, node_type)
nodes.add(node)
else:
edges.add((node_id, next_node_id))
Expand Down

0 comments on commit 6e11727

Please sign in to comment.