posthog icon indicating copy to clipboard operation
posthog copied to clipboard

fix: return query column aliases

Open daibhin opened this issue 1 year ago • 0 comments

Problem

Helps to cleanup a lot in https://github.com/PostHog/posthog/pull/23330

For a query like this:

source: {
  kind: NodeKind.EventsQuery,
  select: [
    'any(properties) as "columns.context.error"',
    'properties.$exception_type',
    `sparkline(reverse(arrayMap(x -> countEqual(groupArray(dateDiff('hour', now() - INTERVAL 1 day, timestamp)), x), range(24)))) as volume`,
    'count() as unique_occurrences -- Occurrences',
    'count(distinct $session_id) as unique_sessions -- Sessions',
    'count(distinct distinct_id) as unique_users -- Users',
    'max(timestamp) as last_seen',
    'min(timestamp) as first_seen',
    ],
  orderBy: [order],
  ...defaultProperties({ dateRange, filterTestAccounts, filterGroup }),
},

the column aliases were not being returned

Changes

Before After
Screenshot 2024-06-28 at 21 03 30 Screenshot 2024-06-28 at 21 02 31

daibhin avatar Jun 28 '24 20:06 daibhin