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.

1.0 KB
Raw Blame
import { useValues } from 'kea'

import { materializationJobsLogic } from 'scenes/data-warehouse/saved_queries/materializationJobsLogic'

import { DataWarehouseSavedQuery } from '~/types'

import { DataQualityChecksPanel } from 'products/data_quality/frontend/DataQualityChecksPanel'

interface ViewDataQualityChecksProps {
    view: DataWarehouseSavedQuery
}

export function ViewDataQualityChecks({ view }: ViewDataQualityChecksProps): JSX.Element {
    // Read the sync time from the run history rather than the view's `last_run_at`, which advances
    // on failed, cancelled and quality-blocked runs too. Those leave the previous version serving,
    // so they must not be named as the sync the checks tested.
    const { lastSuccessfulSyncAt } = useValues(materializationJobsLogic({ viewId: view.id }))

    return (
        <DataQualityChecksPanel
            subjectType="view"
            subjectId={view.id}
            columns={view.columns ?? []}
            dataLastSyncedAt={view.is_materialized ? lastSuccessfulSyncAt : undefined}
        />
    )
}