Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(data-warehouse): show empty state when SQL query returns zero rows (#67429)

posthog[bot]60c2a013d32b
diff --git a/frontend/src/scenes/data-warehouse/editor/OutputPane.tsx b/frontend/src/scenes/data-warehouse/editor/OutputPane.tsx
index bf87a10d3d5a..d9d95894b404 100644
--- a/frontend/src/scenes/data-warehouse/editor/OutputPane.tsx
+++ b/frontend/src/scenes/data-warehouse/editor/OutputPane.tsx
@@ -18,6 +18,7 @@ import {
IconPlus,
IconShare,
IconScreen,
+ IconWarning,
} from '@posthog/icons'
import { LemonBanner, LemonButton, LemonDivider, LemonMenu, LemonModal, LemonTable, Tooltip } from '@posthog/lemon-ui'
@@ -1040,6 +1041,18 @@ const ErrorState = ({ responseError, sourceQuery, queryCancelled, response }: an
)
}
+const EmptyResultsState = (): JSX.Element => {
+ return (
+ <div
+ className="flex flex-1 justify-center items-center gap-2 border-t px-4 py-6 text-center"
+ data-attr="sql-editor-output-pane-no-rows-state"
+ >
+ <IconWarning className="text-warning text-lg" />
+ <span className="text-secondary">Query produced no results</span>
+ </div>
+ )
+}
+
const Content = ({
activeTab,
responseError,
@@ -1192,15 +1205,19 @@ const Content = ({
return (
<div className="flex flex-col flex-1 min-h-0 w-full overflow-hidden">
<SyncWarningsBanner warnings={response?.warnings} />
- <TabScroller data-attr="sql-editor-output-pane-results">
- <DataGrid
- className={clsx(isDarkModeOn ? 'rdg-dark h-full' : 'rdg-light h-full', 'ph-no-capture')}
- columns={columns}
- rows={sortedRows}
- sortColumns={sortColumns}
- onSortColumnsChange={setSortColumns}
- />
- </TabScroller>
+ {rows.length === 0 ? (
+ <EmptyResultsState />
+ ) : (
+ <TabScroller data-attr="sql-editor-output-pane-results">
+ <DataGrid
+ className={clsx(isDarkModeOn ? 'rdg-dark h-full' : 'rdg-light h-full', 'ph-no-capture')}
+ columns={columns}
+ rows={sortedRows}
+ sortColumns={sortColumns}
+ onSortColumnsChange={setSortColumns}
+ />
+ </TabScroller>
+ )}
</div>
)
}