Skip to content

Commit

Permalink
🐛 fix tag fetching for charts
Browse files Browse the repository at this point in the history
  • Loading branch information
Marigold committed May 24, 2024
1 parent ccd624b commit 63d322f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions etl/grapher_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ def tags(self, session: Session) -> List[Dict[str, Any]]:
where ct.chartId = :chart_id
"""
)
rows = session.scalars(q, params={"chart_id": self.id}).fetchall()
return list(rows)
rows = session.execute(q, params={"chart_id": self.id}).mappings().all()
return list(map(dict, rows))

def remove_nonexisting_map_column_slug(self, session: Session) -> None:
"""Remove map.columnSlug if the variable doesn't exist. It'd be better
Expand Down Expand Up @@ -643,7 +643,7 @@ def load_sources(
)
sources.datasetId = sources.datasetId.fillna(dataset_id).astype(int)

return [cls(**d) for d in sources.to_dict(orient="records")] # type: ignore
return [cls.from_dict(d) for d in sources.to_dict(orient="records")] # type: ignore


class SuggestedChartRevisions(Base):
Expand Down Expand Up @@ -1291,7 +1291,7 @@ def from_origin(
descriptionSnapshot=origin.description_snapshot,
description=origin.description,
datePublished=origin.date_published,
dateAccessed=origin.date_accessed,
dateAccessed=origin.date_accessed, # type: ignore
)

@property
Expand Down

0 comments on commit 63d322f

Please sign in to comment.