Skip to content
osmods
PostHog

Looker export

Send saved insights to Looker on a schedule your analysts choose.

View upstream
AuthorAnneli Kask
PublishedMar 2026
LicenseMIT
Installs412

Why it exists

The data team lives in Looker, the product team lives in PostHog, and someone was copying numbers between the two every Monday. This mod registers saved insights as scheduled exports: each one lands in a Looker dataset with its filters, breakdowns and date ranges preserved.

It uses the adapter's export pipeline hook, so it survives PostHog release trains without patching query internals. Exports are incremental, and a failed run retries before it pages anyone.

What it does

  • Registers any saved insight as a scheduled Looker export
  • Preserves filters, breakdowns and relative date ranges
  • Incremental loads with a configurable lookback window
  • Retries failed runs and reports status per export

The spec

These acceptance criteria were written with the person who requested the mod, then locked in as its tests. The mod has to pass them on every new release train before it rides along.

  • A trends insight exported hourly matches the PostHog UI for the same window
  • Renaming the insight in PostHog does not break or duplicate the Looker dataset
  • A revoked Looker key fails visibly in the exports list, not silently

mods/looker-export/tests/incremental.spec.ts

test("re-running an hourly export never duplicates rows", async () => {
  const insight = await fixtures.trendsInsight({ breakdown: "plan" })
  await runExport(insight, { window: "hour" })
  await runExport(insight, { window: "hour" })  // same window, on purpose
  const rows = await looker.rows(insight.datasetId)
expect(rows).toHaveLength(insight.expectedRowCount)
})