diff --git a/posthog/models/insight.py b/posthog/models/insight.py index 3aad1289892c4..e73c44d90dd2d 100644 --- a/posthog/models/insight.py +++ b/posthog/models/insight.py @@ -124,7 +124,11 @@ def query_from_filters(self): from posthog.hogql_queries.legacy_compatibility.filter_to_query import filter_to_query try: - return {"kind": "InsightVizNode", "source": filter_to_query(self.filters).model_dump(), "full": True} + return { + "kind": "InsightVizNode", + "source": filter_to_query(self.filters).model_dump(exclude_none=True), + "full": True, + } except Exception as e: capture_exception(e)