Skip to content

Commit

Permalink
fix: skip invalid joins while building query
Browse files Browse the repository at this point in the history
  • Loading branch information
nextchamp-saqib committed Sep 15, 2023
1 parent 4f74ec6 commit 1a2694a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions insights/insights/query_builders/sql_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,17 +538,20 @@ def process_tables_and_joins(self):
continue

_join = parse_json(row.join)
join_type = _join.get("type").get("value")
join_type = _join.get("type", {}).get("value")

left_table = self.make_table(row.table)
right_table = self.make_table(_join.get("with").get("value"))
right_table = self.make_table(_join.get("with", {}).get("value"))

condition = _join.get("condition")
left_key = condition.get("left").get("value")
right_key = condition.get("right").get("value")
left_key = condition.get("left", {}).get("value")
right_key = condition.get("right", {}).get("value")

left_key = self.make_column(left_key, row.table)
right_key = self.make_column(right_key, _join.get("with").get("value"))
right_key = self.make_column(right_key, _join.get("with", {}).get("value"))

if not left_key or not right_key:
continue

self._joins.append(
_dict(
Expand Down

0 comments on commit 1a2694a

Please sign in to comment.