mirror of
https://github.com/BillyOutlast/posthog.git
synced 2026-02-04 03:01:23 +01:00
feat(revenue-analytics): add virtual revenue properties for groups (#36890)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 179 KiB After Width: | Height: | Size: 182 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 176 KiB After Width: | Height: | Size: 179 KiB |
@@ -37,8 +37,8 @@ export function ViewLinkModal({ mode }: ViewLinkModalProps): JSX.Element {
|
||||
description={
|
||||
mode === 'revenue_analytics' ? (
|
||||
<span>
|
||||
Define a join between the <code>persons</code> table and the <code>customer_revenue_view</code>{' '}
|
||||
Revenue analytics view. <br />
|
||||
Define a join between either the <code>persons</code> or <code>groups</code> table and the{' '}
|
||||
<code>customer_revenue_view</code> Revenue analytics view. <br />
|
||||
<br />
|
||||
<b>All</b> fields from the joined table or view will be accessible in queries at the top level
|
||||
without needing to explicitly join the view. This will also enable you to see revenue for a
|
||||
|
||||
@@ -967,9 +967,8 @@
|
||||
"label": "Page loaded"
|
||||
},
|
||||
"$performance_raw": {
|
||||
"deprecated": true,
|
||||
"description": "The browser performance entries for navigation (the page), paint, and resources. That were available when the page view event fired",
|
||||
"label": "Browser performance",
|
||||
"label": "Browser performance (deprecated)",
|
||||
"system": true
|
||||
},
|
||||
"$plugins_deferred": {
|
||||
@@ -1123,7 +1122,7 @@
|
||||
"$sdk_debug_current_session_duration": {
|
||||
"description": "The current session duration in milliseconds.",
|
||||
"label": "Current session duration",
|
||||
"type": "Number",
|
||||
"type": "Numeric",
|
||||
"used_for_debug": true
|
||||
},
|
||||
"$sdk_debug_replay_event_trigger_status": {
|
||||
@@ -1181,7 +1180,7 @@
|
||||
"$sdk_debug_session_start": {
|
||||
"description": "The timestamp of the session start for the current session id. Not necessarily the same as SDK init time.",
|
||||
"label": "Session start",
|
||||
"type": "Number",
|
||||
"type": "Numeric",
|
||||
"used_for_debug": true
|
||||
},
|
||||
"$search_engine": {
|
||||
@@ -1901,6 +1900,18 @@
|
||||
"$group_key": {
|
||||
"description": "Specified group key",
|
||||
"label": "Group key"
|
||||
},
|
||||
"$virt_revenue": {
|
||||
"description": "The total revenue for this group. This will always be the current total revenue even when referring to a group via events.",
|
||||
"label": "Total revenue",
|
||||
"type": "Numeric",
|
||||
"virtual": true
|
||||
},
|
||||
"$virt_revenue_last_30_days": {
|
||||
"description": "The total revenue for this group in the last 30 days.",
|
||||
"label": "Total revenue in the last 30 days",
|
||||
"type": "Numeric",
|
||||
"virtual": true
|
||||
}
|
||||
},
|
||||
"log_entries": {
|
||||
@@ -3139,9 +3150,8 @@
|
||||
"label": "Page loaded"
|
||||
},
|
||||
"$performance_raw": {
|
||||
"deprecated": true,
|
||||
"description": "The browser performance entries for navigation (the page), paint, and resources. That were available when the page view event fired",
|
||||
"label": "Browser performance",
|
||||
"label": "Browser performance (deprecated)",
|
||||
"system": true
|
||||
},
|
||||
"$plugins_deferred": {
|
||||
@@ -3295,7 +3305,7 @@
|
||||
"$sdk_debug_current_session_duration": {
|
||||
"description": "The current session duration in milliseconds.",
|
||||
"label": "Current session duration",
|
||||
"type": "Number",
|
||||
"type": "Numeric",
|
||||
"used_for_debug": true
|
||||
},
|
||||
"$sdk_debug_replay_event_trigger_status": {
|
||||
@@ -3353,7 +3363,7 @@
|
||||
"$sdk_debug_session_start": {
|
||||
"description": "The timestamp of the session start for the current session id. Not necessarily the same as SDK init time.",
|
||||
"label": "Session start",
|
||||
"type": "Number",
|
||||
"type": "Numeric",
|
||||
"used_for_debug": true
|
||||
},
|
||||
"$search_engine": {
|
||||
@@ -3722,7 +3732,7 @@
|
||||
"virtual": true
|
||||
},
|
||||
"$virt_revenue": {
|
||||
"description": "The total revenue for this person.",
|
||||
"description": "The total revenue for this person. This will always be the current total revenue even when referring to a person via events.",
|
||||
"label": "Total revenue",
|
||||
"type": "Numeric",
|
||||
"virtual": true
|
||||
|
||||
@@ -333,8 +333,16 @@ class TestPropertyDefinitionAPI(APIBaseTest):
|
||||
|
||||
@parameterized.expand(
|
||||
[
|
||||
("Get all group1 properties", "type=group&group_type_index=1", ["group1 another", "group1 property"]),
|
||||
("Get all group2 properties", "type=group&group_type_index=2", ["group2 property"]),
|
||||
(
|
||||
"Get all group1 properties",
|
||||
"type=group&group_type_index=1",
|
||||
["group1 another", "group1 property", "$virt_revenue", "$virt_revenue_last_30_days"],
|
||||
),
|
||||
(
|
||||
"Get all group2 properties",
|
||||
"type=group&group_type_index=2",
|
||||
["group2 property", "$virt_revenue", "$virt_revenue_last_30_days"],
|
||||
),
|
||||
(
|
||||
"Search group1 properties containing 'prop'",
|
||||
"type=group&search=prop&group_type_index=1",
|
||||
@@ -716,6 +724,13 @@ class TestPropertyDefinitionAPI(APIBaseTest):
|
||||
# Should exclude the specified virtual property
|
||||
assert not any(prop["name"] == "$virt_initial_channel_type" for prop in response.json()["results"])
|
||||
|
||||
response = self.client.get(
|
||||
f'/api/projects/{self.team.pk}/property_definitions/?type=group&group_type_index=0&excluded_properties=["$virt_revenue"]'
|
||||
)
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
# Should exclude the specified virtual property
|
||||
assert not any(prop["name"] == "$virt_revenue" for prop in response.json()["results"])
|
||||
|
||||
def test_virtual_property_excluded_by_core(self):
|
||||
response = self.client.get(
|
||||
f"/api/projects/{self.team.pk}/property_definitions/?type=person&exclude_core_properties=true"
|
||||
@@ -725,6 +740,14 @@ class TestPropertyDefinitionAPI(APIBaseTest):
|
||||
virtual_props = [prop for prop in response.json()["results"] if prop["name"].startswith("$virt_")]
|
||||
assert len(virtual_props) > 0
|
||||
|
||||
response = self.client.get(
|
||||
f"/api/projects/{self.team.pk}/property_definitions/?type=group&group_type_index=0&exclude_core_properties=true"
|
||||
)
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
# Virtual properties should still be included when excluding core properties
|
||||
virtual_props = [prop for prop in response.json()["results"] if prop["name"].startswith("$virt_")]
|
||||
assert len(virtual_props) > 0
|
||||
|
||||
def test_virtual_property_type_filter(self):
|
||||
response = self.client.get(f"/api/projects/{self.team.pk}/property_definitions/?type=person")
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
@@ -732,6 +755,12 @@ class TestPropertyDefinitionAPI(APIBaseTest):
|
||||
virtual_props = [prop for prop in response.json()["results"] if prop["name"].startswith("$virt_")]
|
||||
assert len(virtual_props) > 0
|
||||
|
||||
response = self.client.get(f"/api/projects/{self.team.pk}/property_definitions/?type=group&group_type_index=0")
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
# Should include virtual properties when type=group
|
||||
virtual_props = [prop for prop in response.json()["results"] if prop["name"].startswith("$virt_")]
|
||||
assert len(virtual_props) > 0
|
||||
|
||||
response = self.client.get(f"/api/projects/{self.team.pk}/property_definitions/?type=event")
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
# Should not include virtual properties when type=event
|
||||
|
||||
@@ -173,6 +173,7 @@ class BaseTableType(Type):
|
||||
table_type=self, name=name, expr=field.expr, isolate_scope=field.isolate_scope or False
|
||||
)
|
||||
return FieldType(name=name, table_type=self)
|
||||
|
||||
raise QueryError(f"Field not found: {name}")
|
||||
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ from posthog.hogql.database.schema.error_tracking_issue_fingerprint_overrides im
|
||||
from posthog.hogql.database.schema.events import EventsTable
|
||||
from posthog.hogql.database.schema.exchange_rate import ExchangeRateTable
|
||||
from posthog.hogql.database.schema.groups import GroupsTable, RawGroupsTable
|
||||
from posthog.hogql.database.schema.groups_revenue_analytics import GroupsRevenueAnalyticsTable
|
||||
from posthog.hogql.database.schema.heatmaps import HeatmapsTable
|
||||
from posthog.hogql.database.schema.log_entries import (
|
||||
BatchExportLogEntriesTable,
|
||||
@@ -155,6 +156,7 @@ class Database(BaseModel):
|
||||
|
||||
# Revenue analytics tables
|
||||
persons_revenue_analytics: PersonsRevenueAnalyticsTable = PersonsRevenueAnalyticsTable()
|
||||
groups_revenue_analytics: GroupsRevenueAnalyticsTable = GroupsRevenueAnalyticsTable()
|
||||
|
||||
raw_session_replay_events: RawSessionReplayEventsTable = RawSessionReplayEventsTable()
|
||||
raw_person_distinct_ids: RawPersonDistinctIdsTable = RawPersonDistinctIdsTable()
|
||||
@@ -435,6 +437,7 @@ def _use_virtual_fields(database: Database, modifiers: HogQLQueryModifiers, timi
|
||||
chain = ["revenue_analytics", field]
|
||||
|
||||
database.persons.fields[field_name] = ast.FieldTraverser(chain=chain)
|
||||
database.groups.fields[field_name] = ast.FieldTraverser(chain=chain)
|
||||
poe.fields[field_name] = ast.FieldTraverser(chain=chain)
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ from posthog.hogql.database.models import (
|
||||
DateTimeDatabaseField,
|
||||
FieldOrTable,
|
||||
IntegerDatabaseField,
|
||||
LazyJoin,
|
||||
LazyJoinToAdd,
|
||||
LazyTable,
|
||||
LazyTableToAdd,
|
||||
@@ -12,6 +13,10 @@ from posthog.hogql.database.models import (
|
||||
StringJSONDatabaseField,
|
||||
Table,
|
||||
)
|
||||
from posthog.hogql.database.schema.groups_revenue_analytics import (
|
||||
GroupsRevenueAnalyticsTable,
|
||||
join_with_groups_revenue_analytics_table,
|
||||
)
|
||||
from posthog.hogql.errors import ResolutionError
|
||||
|
||||
GROUPS_TABLE_FIELDS: dict[str, FieldOrTable] = {
|
||||
@@ -21,6 +26,11 @@ GROUPS_TABLE_FIELDS: dict[str, FieldOrTable] = {
|
||||
"created_at": DateTimeDatabaseField(name="created_at", nullable=False),
|
||||
"updated_at": DateTimeDatabaseField(name="_timestamp", nullable=False),
|
||||
"properties": StringJSONDatabaseField(name="group_properties", nullable=False),
|
||||
"revenue_analytics": LazyJoin(
|
||||
from_field=["key"],
|
||||
join_table=GroupsRevenueAnalyticsTable(),
|
||||
join_function=join_with_groups_revenue_analytics_table,
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
|
||||
199
posthog/hogql/database/schema/groups_revenue_analytics.py
Normal file
199
posthog/hogql/database/schema/groups_revenue_analytics.py
Normal file
@@ -0,0 +1,199 @@
|
||||
from collections import defaultdict
|
||||
|
||||
from posthog.hogql import ast
|
||||
from posthog.hogql.context import HogQLContext
|
||||
from posthog.hogql.database.models import (
|
||||
DecimalDatabaseField,
|
||||
FieldOrTable,
|
||||
IntegerDatabaseField,
|
||||
LazyJoinToAdd,
|
||||
LazyTable,
|
||||
LazyTableToAdd,
|
||||
StringDatabaseField,
|
||||
)
|
||||
from posthog.hogql.errors import ResolutionError
|
||||
from posthog.hogql.parser import parse_expr
|
||||
|
||||
|
||||
def join_with_groups_revenue_analytics_table(
|
||||
join_to_add: LazyJoinToAdd,
|
||||
context: HogQLContext,
|
||||
node: ast.SelectQuery,
|
||||
):
|
||||
if not join_to_add.fields_accessed:
|
||||
raise ResolutionError("No fields requested from `groups_revenue_analytics`")
|
||||
|
||||
return ast.JoinExpr(
|
||||
alias=join_to_add.to_table,
|
||||
table=select_from_groups_revenue_analytics_table(context),
|
||||
join_type="LEFT JOIN",
|
||||
constraint=ast.JoinConstraint(
|
||||
expr=ast.CompareOperation(
|
||||
op=ast.CompareOperationOp.Eq,
|
||||
left=ast.Field(chain=[join_to_add.from_table, *join_to_add.lazy_join.from_field]),
|
||||
right=ast.Field(chain=[join_to_add.to_table, "group_key"]),
|
||||
),
|
||||
constraint_type="ON",
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def select_from_groups_revenue_analytics_table(context: HogQLContext) -> ast.SelectQuery | ast.SelectSetQuery:
|
||||
from products.revenue_analytics.backend.views import (
|
||||
RevenueAnalyticsBaseView,
|
||||
RevenueAnalyticsCustomerView,
|
||||
RevenueAnalyticsRevenueItemView,
|
||||
)
|
||||
|
||||
columns = ["group_key", "revenue", "revenue_last_30_days"]
|
||||
|
||||
if not context.database:
|
||||
return ast.SelectQuery.empty(columns=columns)
|
||||
|
||||
# Get all customer/revenue item pairs from the existing views
|
||||
all_views: dict[str, dict[type[RevenueAnalyticsBaseView], RevenueAnalyticsBaseView]] = defaultdict(defaultdict)
|
||||
for view_name in context.database.get_views():
|
||||
view = context.database.get_table(view_name)
|
||||
|
||||
if isinstance(view, RevenueAnalyticsCustomerView):
|
||||
all_views[view.prefix][RevenueAnalyticsCustomerView] = view
|
||||
elif isinstance(view, RevenueAnalyticsRevenueItemView):
|
||||
all_views[view.prefix][RevenueAnalyticsRevenueItemView] = view
|
||||
|
||||
# Iterate over all possible view pairs and figure out which queries we can add to the set
|
||||
queries = []
|
||||
for views in all_views.values():
|
||||
customer_view = views.get(RevenueAnalyticsCustomerView)
|
||||
revenue_item_view = views.get(RevenueAnalyticsRevenueItemView)
|
||||
|
||||
# Only proceed for those where we have customer/revenue_item pairs
|
||||
if customer_view is None or revenue_item_view is None:
|
||||
continue
|
||||
|
||||
# If we're working with event views, we can use the group_key field directly
|
||||
# but note that we're getting this from the `RevenueItemView` rather than `Customer`
|
||||
# because we don't expose what group a person belongs to, only
|
||||
# Otherwise, we need to join with the groups table by checking whether it exists
|
||||
# connected to the virtual CustomerView
|
||||
group_key_chains: list[ast.Expr] = []
|
||||
if customer_view.is_event_view():
|
||||
group_key_chains = [
|
||||
ast.Field(chain=[RevenueAnalyticsRevenueItemView.get_generic_view_alias(), f"group_{index}_key"])
|
||||
for index in range(5) # [0, 1, 2, 3, 4]
|
||||
]
|
||||
else:
|
||||
groups_lazy_join = customer_view.fields.get("groups")
|
||||
if groups_lazy_join is not None and isinstance(groups_lazy_join, ast.LazyJoin):
|
||||
group_key_chains = [
|
||||
ast.Field(chain=[RevenueAnalyticsCustomerView.get_generic_view_alias(), "groups", "key"])
|
||||
]
|
||||
|
||||
if len(group_key_chains) > 0:
|
||||
queries.append(
|
||||
ast.SelectQuery(
|
||||
select=[
|
||||
# `team_id` is required to make HogQL happy and edge-case free
|
||||
# by avoiding the need to add an exception when querying this table
|
||||
#
|
||||
# This table is always safe to query "without a `team_id` filter"
|
||||
# because it's simply aggregating data from revenue warehouse views,
|
||||
# and those views are, on their own, safe to query "without a `team_id` filter"
|
||||
# since they're getting data from either the data warehouse (safe) or the events table (safe)
|
||||
ast.Alias(alias="team_id", expr=ast.Constant(value=context.team_id)),
|
||||
# We'll create one row per each possible group key (5 for events, and then only one for joins)
|
||||
ast.Alias(
|
||||
alias="group_key", expr=ast.Call(name="arrayJoin", args=[ast.Array(exprs=group_key_chains)])
|
||||
),
|
||||
ast.Alias(
|
||||
alias="revenue",
|
||||
expr=ast.Call(
|
||||
name="sum",
|
||||
args=[
|
||||
ast.Field(
|
||||
chain=[RevenueAnalyticsRevenueItemView.get_generic_view_alias(), "amount"]
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
ast.Alias(
|
||||
alias="revenue_last_30_days",
|
||||
expr=ast.Call(
|
||||
name="sumIf",
|
||||
args=[
|
||||
ast.Field(
|
||||
chain=[RevenueAnalyticsRevenueItemView.get_generic_view_alias(), "amount"]
|
||||
),
|
||||
ast.CompareOperation(
|
||||
op=ast.CompareOperationOp.GtEq,
|
||||
left=ast.Field(
|
||||
chain=[
|
||||
RevenueAnalyticsRevenueItemView.get_generic_view_alias(),
|
||||
"timestamp",
|
||||
]
|
||||
),
|
||||
# For POE, we *should* be able to use the events.timestamp field
|
||||
# but that's not possible given Clickhouse's limitations on what you can do in a subquery
|
||||
# We should figure out a way to do this in the future
|
||||
# "toDate(events.timestamp) - INTERVAL {interval} DAY" if is_poe else "today() - INTERVAL {interval} DAY",
|
||||
right=parse_expr("today() - INTERVAL 30 DAY"),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
select_from=ast.JoinExpr(
|
||||
alias=RevenueAnalyticsCustomerView.get_generic_view_alias(),
|
||||
table=ast.Field(chain=[customer_view.name]),
|
||||
next_join=ast.JoinExpr(
|
||||
alias=RevenueAnalyticsRevenueItemView.get_generic_view_alias(),
|
||||
table=ast.Field(chain=[revenue_item_view.name]),
|
||||
join_type="LEFT JOIN",
|
||||
constraint=ast.JoinConstraint(
|
||||
constraint_type="ON",
|
||||
expr=ast.CompareOperation(
|
||||
op=ast.CompareOperationOp.Eq,
|
||||
left=ast.Field(chain=[RevenueAnalyticsCustomerView.get_generic_view_alias(), "id"]),
|
||||
right=ast.Field(
|
||||
chain=[RevenueAnalyticsRevenueItemView.get_generic_view_alias(), "customer_id"]
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
group_by=[ast.Field(chain=["group_key"])],
|
||||
where=ast.Call(
|
||||
name="notEmpty",
|
||||
args=[ast.Field(chain=["group_key"])],
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
if not queries:
|
||||
return ast.SelectQuery.empty(columns=columns)
|
||||
elif len(queries) == 1:
|
||||
return queries[0]
|
||||
else:
|
||||
return ast.SelectSetQuery.create_from_queries(queries, set_operator="UNION ALL")
|
||||
|
||||
|
||||
class GroupsRevenueAnalyticsTable(LazyTable):
|
||||
fields: dict[str, FieldOrTable] = {
|
||||
"team_id": IntegerDatabaseField(name="team_id"),
|
||||
"group_key": StringDatabaseField(name="group_key"),
|
||||
"revenue": DecimalDatabaseField(name="revenue", nullable=False),
|
||||
"revenue_last_30_days": DecimalDatabaseField(name="revenue_last_30_days", nullable=False),
|
||||
}
|
||||
|
||||
def lazy_select(
|
||||
self,
|
||||
table_to_add: LazyTableToAdd,
|
||||
context: HogQLContext,
|
||||
node: ast.SelectQuery,
|
||||
):
|
||||
return select_from_groups_revenue_analytics_table(context)
|
||||
|
||||
def to_printed_clickhouse(self, context):
|
||||
return "groups_revenue_analytics"
|
||||
|
||||
def to_printed_hogql(self):
|
||||
return "groups_revenue_analytics"
|
||||
@@ -0,0 +1,781 @@
|
||||
# serializer version: 1
|
||||
# name: TestRevenueAnalytics.test_get_revenue_for_events
|
||||
'''
|
||||
SELECT groups.key AS key,
|
||||
groups__revenue_analytics.revenue AS revenue,
|
||||
groups__revenue_analytics.revenue AS `$virt_revenue`
|
||||
FROM
|
||||
(SELECT argMax(groups.group_key, toTimeZone(groups._timestamp, 'UTC')) AS groups___key,
|
||||
groups.group_type_index AS index,
|
||||
groups.group_key AS key
|
||||
FROM groups
|
||||
WHERE equals(groups.team_id, 99999)
|
||||
GROUP BY groups.group_type_index,
|
||||
groups.group_key) AS groups
|
||||
LEFT JOIN
|
||||
(SELECT 99999 AS team_id,
|
||||
arrayJoin([revenue_analytics_revenue_item.group_0_key, revenue_analytics_revenue_item.group_1_key, revenue_analytics_revenue_item.group_2_key, revenue_analytics_revenue_item.group_3_key, revenue_analytics_revenue_item.group_4_key]) AS group_key,
|
||||
sum(revenue_analytics_revenue_item.amount) AS revenue,
|
||||
sumIf(revenue_analytics_revenue_item.amount, ifNull(greaterOrEquals(revenue_analytics_revenue_item.timestamp, minus(today(), toIntervalDay(30))), 0)) AS revenue_last_30_days
|
||||
FROM
|
||||
(SELECT toString(persons.id) AS id,
|
||||
'revenue_analytics.events.purchase' AS source_label,
|
||||
persons.created_at AS timestamp,
|
||||
persons.properties___name AS name,
|
||||
persons.properties___email AS email,
|
||||
persons.properties___phone AS phone,
|
||||
persons.properties___address AS address,
|
||||
persons.properties___metadata AS metadata,
|
||||
persons.`properties___$geoip_country_name` AS country,
|
||||
formatDateTime(toStartOfMonth(persons.created_at), '%Y-%m') AS cohort,
|
||||
NULL AS initial_coupon,
|
||||
NULL AS initial_coupon_id
|
||||
FROM
|
||||
(SELECT person.id AS id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'name'), ''), 'null'), '^"|"$', '') AS properties___name,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'email'), ''), 'null'), '^"|"$', '') AS properties___email,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'phone'), ''), 'null'), '^"|"$', '') AS properties___phone,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'address'), ''), 'null'), '^"|"$', '') AS properties___address,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'metadata'), ''), 'null'), '^"|"$', '') AS properties___metadata,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, '$geoip_country_name'), ''), 'null'), '^"|"$', '') AS `properties___$geoip_country_name`,
|
||||
toTimeZone(person.created_at, 'UTC') AS created_at
|
||||
FROM person
|
||||
WHERE and(equals(person.team_id, 99999), in(tuple(person.id, person.version),
|
||||
(SELECT person.id AS id, max(person.version) AS version
|
||||
FROM person
|
||||
WHERE equals(person.team_id, 99999)
|
||||
GROUP BY person.id
|
||||
HAVING and(ifNull(equals(argMax(person.is_deleted, person.version), 0), 0), ifNull(less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))), 0))
|
||||
ORDER BY argMax(toTimeZone(person.created_at, 'UTC'), person.version) DESC))) SETTINGS optimize_aggregation_in_order=1) AS persons
|
||||
INNER JOIN
|
||||
(SELECT DISTINCT events__person.id AS person_id
|
||||
FROM events
|
||||
LEFT OUTER JOIN
|
||||
(SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,
|
||||
person_distinct_id_overrides.distinct_id AS distinct_id
|
||||
FROM person_distinct_id_overrides
|
||||
WHERE equals(person_distinct_id_overrides.team_id, 99999)
|
||||
GROUP BY person_distinct_id_overrides.distinct_id
|
||||
HAVING ifNull(equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
|
||||
LEFT JOIN
|
||||
(SELECT person.id AS id
|
||||
FROM person
|
||||
WHERE equals(person.team_id, 99999)
|
||||
GROUP BY person.id
|
||||
HAVING and(ifNull(equals(argMax(person.is_deleted, person.version), 0), 0), ifNull(less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))), 0)) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id)
|
||||
WHERE and(equals(events.team_id, 99999), 1)) AS events ON equals(persons.id, events.person_id)
|
||||
ORDER BY persons.created_at DESC) AS revenue_analytics_customer
|
||||
LEFT JOIN
|
||||
(SELECT toString(events.uuid) AS id,
|
||||
toString(events.uuid) AS invoice_item_id,
|
||||
'revenue_analytics.events.purchase' AS source_label,
|
||||
toTimeZone(events.timestamp, 'UTC') AS timestamp,
|
||||
timestamp AS created_at,
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
events.event AS event_name,
|
||||
NULL AS coupon,
|
||||
coupon AS coupon_id,
|
||||
'USD' AS original_currency,
|
||||
accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Decimal64(10)') AS original_amount,
|
||||
in(original_currency,
|
||||
['BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'UGX', 'VND', 'VUV', 'XAF', 'XOF', 'XPF']) AS enable_currency_aware_divider,
|
||||
if(enable_currency_aware_divider, accurateCastOrNull(1, 'Decimal64(10)'), accurateCastOrNull(100, 'Decimal64(10)')) AS currency_aware_divider,
|
||||
divideDecimal(original_amount, currency_aware_divider) AS currency_aware_amount,
|
||||
'USD' AS currency,
|
||||
if(isNull('USD'), accurateCastOrNull(currency_aware_amount, 'Decimal64(10)'), if(equals('USD', 'USD'), toDecimal64(currency_aware_amount, 10), if(dictGetOrDefault(`posthog_test`.`exchange_rate_dict`, 'rate', 'USD', toDate(toTimeZone(events.timestamp, 'UTC')), toDecimal64(0, 10)) = 0, toDecimal64(0, 10), multiplyDecimal(divideDecimal(toDecimal64(currency_aware_amount, 10), dictGetOrDefault(`posthog_test`.`exchange_rate_dict`, 'rate', 'USD', toDate(toTimeZone(events.timestamp, 'UTC')), toDecimal64(0, 10))), dictGetOrDefault(`posthog_test`.`exchange_rate_dict`, 'rate', 'USD', toDate(toTimeZone(events.timestamp, 'UTC')), toDecimal64(0, 10)))))) AS amount
|
||||
FROM events
|
||||
LEFT OUTER JOIN
|
||||
(SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,
|
||||
person_distinct_id_overrides.distinct_id AS distinct_id
|
||||
FROM person_distinct_id_overrides
|
||||
WHERE equals(person_distinct_id_overrides.team_id, 99999)
|
||||
GROUP BY person_distinct_id_overrides.distinct_id
|
||||
HAVING ifNull(equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
|
||||
WHERE and(equals(events.team_id, 99999), and(equals(events.event, 'purchase'), 1, isNotNull(amount)))
|
||||
ORDER BY timestamp DESC) AS revenue_analytics_revenue_item ON equals(revenue_analytics_customer.id, revenue_analytics_revenue_item.customer_id)
|
||||
WHERE notEmpty(group_key)
|
||||
GROUP BY group_key) AS groups__revenue_analytics ON equals(groups.groups___key, groups__revenue_analytics.group_key)
|
||||
WHERE ifNull(equals(groups.key, 'lolol0:xxx'), 0)
|
||||
LIMIT 100 SETTINGS readonly=2,
|
||||
max_execution_time=60,
|
||||
allow_experimental_object_type=1,
|
||||
format_csv_allow_double_quotes=0,
|
||||
max_ast_elements=4000000,
|
||||
max_expanded_ast_elements=4000000,
|
||||
max_bytes_before_external_group_by=0,
|
||||
transform_null_in=1,
|
||||
optimize_min_equality_disjunction_chain_length=4294967295,
|
||||
allow_experimental_join_condition=1
|
||||
'''
|
||||
# ---
|
||||
# name: TestRevenueAnalytics.test_get_revenue_for_schema_source_for_email_join
|
||||
'''
|
||||
SELECT groups.key AS key,
|
||||
groups__revenue_analytics.revenue AS revenue,
|
||||
groups__revenue_analytics.revenue AS `$virt_revenue`
|
||||
FROM
|
||||
(SELECT argMax(groups.group_key, toTimeZone(groups._timestamp, 'UTC')) AS groups___key,
|
||||
groups.group_type_index AS index,
|
||||
groups.group_key AS key
|
||||
FROM groups
|
||||
WHERE equals(groups.team_id, 99999)
|
||||
GROUP BY groups.group_type_index,
|
||||
groups.group_key) AS groups
|
||||
LEFT JOIN
|
||||
(SELECT 99999 AS team_id,
|
||||
arrayJoin([revenue_analytics_customer__groups.key]) AS group_key,
|
||||
sum(revenue_analytics_revenue_item.amount) AS revenue,
|
||||
sumIf(revenue_analytics_revenue_item.amount, ifNull(greaterOrEquals(revenue_analytics_revenue_item.timestamp, minus(today(), toIntervalDay(30))), 0)) AS revenue_last_30_days
|
||||
FROM
|
||||
(SELECT outer.id AS id,
|
||||
'stripe.posthog_test' AS source_label,
|
||||
parseDateTime64BestEffortOrNull(toString(outer.created), 6, 'UTC') AS timestamp,
|
||||
outer.name AS name,
|
||||
outer.email AS email,
|
||||
outer.phone AS phone,
|
||||
outer.address AS address,
|
||||
outer.metadata AS metadata,
|
||||
JSONExtractString(address, 'country') AS country,
|
||||
cohort_inner.cohort AS cohort,
|
||||
cohort_inner.initial_coupon AS initial_coupon,
|
||||
cohort_inner.initial_coupon_id AS initial_coupon_id
|
||||
FROM
|
||||
(SELECT *
|
||||
FROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_customers/posthog_test_stripe_customer/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `name` String, `email` String, `phone` String, `address` String, `created` DateTime, `metadata` String')) AS outer
|
||||
LEFT JOIN
|
||||
(SELECT invoice.customer AS customer_id,
|
||||
formatDateTime(toStartOfMonth(min(parseDateTime64BestEffortOrNull(toString(invoice.created), 6, 'UTC'))), '%Y-%m') AS cohort,
|
||||
argMin(JSONExtractString(invoice.discount, 'coupon', 'name'), parseDateTime64BestEffortOrNull(toString(invoice.created), 6, 'UTC')) AS initial_coupon,
|
||||
argMin(JSONExtractString(invoice.discount, 'coupon', 'id'), parseDateTime64BestEffortOrNull(toString(invoice.created), 6, 'UTC')) AS initial_coupon_id
|
||||
FROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS invoice
|
||||
GROUP BY invoice.customer) AS cohort_inner ON equals(cohort_inner.customer_id, outer.id)) AS revenue_analytics_customer GLOBAL
|
||||
LEFT JOIN
|
||||
(SELECT groups.key AS key,
|
||||
key AS revenue_analytics_customer__groups___key
|
||||
FROM
|
||||
(SELECT groups.group_type_index AS index,
|
||||
groups.group_key AS key
|
||||
FROM groups
|
||||
WHERE equals(groups.team_id, 99999)
|
||||
GROUP BY groups.group_type_index,
|
||||
groups.group_key) AS groups) AS revenue_analytics_customer__groups ON equals(revenue_analytics_customer.email, revenue_analytics_customer__groups.revenue_analytics_customer__groups___key)
|
||||
LEFT JOIN
|
||||
(SELECT if(ifNull(greater(invoice.period_months, 1), 0), concat(ifNull(toString(invoice.invoice_item_id), ''), '_', ifNull(toString(invoice.month_index), '')), invoice.invoice_item_id) AS id,
|
||||
invoice.invoice_item_id AS invoice_item_id,
|
||||
'stripe.posthog_test' AS source_label,
|
||||
addMonths(invoice.timestamp, invoice.month_index) AS timestamp,
|
||||
invoice.created_at AS created_at,
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
NULL AS event_name,
|
||||
JSONExtractString(invoice.discount, 'coupon', 'name') AS coupon,
|
||||
JSONExtractString(invoice.discount, 'coupon', 'id') AS coupon_id,
|
||||
upper(invoice.currency) AS original_currency,
|
||||
accurateCastOrNull(invoice.amount_captured, 'Decimal64(10)') AS original_amount,
|
||||
in(original_currency,
|
||||
['BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'UGX', 'VND', 'VUV', 'XAF', 'XOF', 'XPF']) AS enable_currency_aware_divider,
|
||||
if(enable_currency_aware_divider, accurateCastOrNull(1, 'Decimal64(10)'), accurateCastOrNull(100, 'Decimal64(10)')) AS currency_aware_divider,
|
||||
divideDecimal(original_amount, currency_aware_divider) AS currency_aware_amount,
|
||||
'GBP' AS currency,
|
||||
divideDecimal(if(equals(original_currency, currency), toDecimal64(currency_aware_amount, 10), if(dictGetOrDefault(`posthog_test`.`exchange_rate_dict`, 'rate', original_currency, toDate(ifNull(timestamp, toDateTime(0, 'UTC'))), toDecimal64(0, 10)) = 0, toDecimal64(0, 10), multiplyDecimal(divideDecimal(toDecimal64(currency_aware_amount, 10), dictGetOrDefault(`posthog_test`.`exchange_rate_dict`, 'rate', original_currency, toDate(ifNull(timestamp, toDateTime(0, 'UTC'))), toDecimal64(0, 10))), dictGetOrDefault(`posthog_test`.`exchange_rate_dict`, 'rate', currency, toDate(ifNull(timestamp, toDateTime(0, 'UTC'))), toDecimal64(0, 10))))), accurateCastOrNull(invoice.period_months, 'Decimal64(10)')) AS amount
|
||||
FROM
|
||||
(SELECT posthog_test_stripe_invoice.id AS id,
|
||||
parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC') AS created_at,
|
||||
posthog_test_stripe_invoice.customer AS customer_id,
|
||||
posthog_test_stripe_invoice.subscription AS subscription_id,
|
||||
posthog_test_stripe_invoice.discount AS discount,
|
||||
arrayJoin(JSONExtractArrayRaw(assumeNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(posthog_test_stripe_invoice.lines, 'data'), ''), 'null'), '^"|"$', '')))) AS data,
|
||||
JSONExtractString(data, 'id') AS invoice_item_id,
|
||||
JSONExtractString(data, 'amount') AS amount_captured,
|
||||
JSONExtractString(data, 'currency') AS currency,
|
||||
JSONExtractString(data, 'price', 'product') AS product_id,
|
||||
fromUnixTimestamp(JSONExtractUInt(data, 'period', 'start')) AS period_start,
|
||||
fromUnixTimestamp(JSONExtractUInt(data, 'period', 'end')) AS period_end,
|
||||
greatest(toInt16(round(divide(dateDiff('day', ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')), ifNull(period_end, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC'))), 30.44))), 1) AS period_months,
|
||||
arrayJoin(range(0, period_months)) AS month_index,
|
||||
ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestamp
|
||||
FROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice
|
||||
WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item ON equals(revenue_analytics_customer.id, revenue_analytics_revenue_item.customer_id)
|
||||
WHERE notEmpty(group_key)
|
||||
GROUP BY group_key) AS groups__revenue_analytics ON equals(groups.groups___key, groups__revenue_analytics.group_key)
|
||||
ORDER BY groups.key ASC
|
||||
LIMIT 100 SETTINGS readonly=2,
|
||||
max_execution_time=60,
|
||||
allow_experimental_object_type=1,
|
||||
format_csv_allow_double_quotes=1,
|
||||
max_ast_elements=4000000,
|
||||
max_expanded_ast_elements=4000000,
|
||||
max_bytes_before_external_group_by=0,
|
||||
transform_null_in=1,
|
||||
optimize_min_equality_disjunction_chain_length=4294967295,
|
||||
allow_experimental_join_condition=1
|
||||
'''
|
||||
# ---
|
||||
# name: TestRevenueAnalytics.test_get_revenue_for_schema_source_for_id_join
|
||||
'''
|
||||
SELECT groups.key AS key,
|
||||
groups__revenue_analytics.revenue AS revenue
|
||||
FROM
|
||||
(SELECT argMax(groups.group_key, toTimeZone(groups._timestamp, 'UTC')) AS groups___key,
|
||||
groups.group_type_index AS index,
|
||||
groups.group_key AS key
|
||||
FROM groups
|
||||
WHERE equals(groups.team_id, 99999)
|
||||
GROUP BY groups.group_type_index,
|
||||
groups.group_key) AS groups
|
||||
LEFT JOIN
|
||||
(SELECT 99999 AS team_id,
|
||||
arrayJoin([revenue_analytics_customer__groups.key]) AS group_key,
|
||||
sum(revenue_analytics_revenue_item.amount) AS revenue,
|
||||
sumIf(revenue_analytics_revenue_item.amount, ifNull(greaterOrEquals(revenue_analytics_revenue_item.timestamp, minus(today(), toIntervalDay(30))), 0)) AS revenue_last_30_days
|
||||
FROM
|
||||
(SELECT outer.id AS id,
|
||||
'stripe.posthog_test' AS source_label,
|
||||
parseDateTime64BestEffortOrNull(toString(outer.created), 6, 'UTC') AS timestamp,
|
||||
outer.name AS name,
|
||||
outer.email AS email,
|
||||
outer.phone AS phone,
|
||||
outer.address AS address,
|
||||
outer.metadata AS metadata,
|
||||
JSONExtractString(address, 'country') AS country,
|
||||
cohort_inner.cohort AS cohort,
|
||||
cohort_inner.initial_coupon AS initial_coupon,
|
||||
cohort_inner.initial_coupon_id AS initial_coupon_id
|
||||
FROM
|
||||
(SELECT *
|
||||
FROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_customers/posthog_test_stripe_customer/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `name` String, `email` String, `phone` String, `address` String, `created` DateTime, `metadata` String')) AS outer
|
||||
LEFT JOIN
|
||||
(SELECT invoice.customer AS customer_id,
|
||||
formatDateTime(toStartOfMonth(min(parseDateTime64BestEffortOrNull(toString(invoice.created), 6, 'UTC'))), '%Y-%m') AS cohort,
|
||||
argMin(JSONExtractString(invoice.discount, 'coupon', 'name'), parseDateTime64BestEffortOrNull(toString(invoice.created), 6, 'UTC')) AS initial_coupon,
|
||||
argMin(JSONExtractString(invoice.discount, 'coupon', 'id'), parseDateTime64BestEffortOrNull(toString(invoice.created), 6, 'UTC')) AS initial_coupon_id
|
||||
FROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS invoice
|
||||
GROUP BY invoice.customer) AS cohort_inner ON equals(cohort_inner.customer_id, outer.id)) AS revenue_analytics_customer GLOBAL
|
||||
LEFT JOIN
|
||||
(SELECT groups.key AS key,
|
||||
key AS revenue_analytics_customer__groups___key
|
||||
FROM
|
||||
(SELECT groups.group_type_index AS index,
|
||||
groups.group_key AS key
|
||||
FROM groups
|
||||
WHERE equals(groups.team_id, 99999)
|
||||
GROUP BY groups.group_type_index,
|
||||
groups.group_key) AS groups) AS revenue_analytics_customer__groups ON equals(revenue_analytics_customer.id, revenue_analytics_customer__groups.revenue_analytics_customer__groups___key)
|
||||
LEFT JOIN
|
||||
(SELECT if(ifNull(greater(invoice.period_months, 1), 0), concat(ifNull(toString(invoice.invoice_item_id), ''), '_', ifNull(toString(invoice.month_index), '')), invoice.invoice_item_id) AS id,
|
||||
invoice.invoice_item_id AS invoice_item_id,
|
||||
'stripe.posthog_test' AS source_label,
|
||||
addMonths(invoice.timestamp, invoice.month_index) AS timestamp,
|
||||
invoice.created_at AS created_at,
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
NULL AS event_name,
|
||||
JSONExtractString(invoice.discount, 'coupon', 'name') AS coupon,
|
||||
JSONExtractString(invoice.discount, 'coupon', 'id') AS coupon_id,
|
||||
upper(invoice.currency) AS original_currency,
|
||||
accurateCastOrNull(invoice.amount_captured, 'Decimal64(10)') AS original_amount,
|
||||
in(original_currency,
|
||||
['BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'UGX', 'VND', 'VUV', 'XAF', 'XOF', 'XPF']) AS enable_currency_aware_divider,
|
||||
if(enable_currency_aware_divider, accurateCastOrNull(1, 'Decimal64(10)'), accurateCastOrNull(100, 'Decimal64(10)')) AS currency_aware_divider,
|
||||
divideDecimal(original_amount, currency_aware_divider) AS currency_aware_amount,
|
||||
'GBP' AS currency,
|
||||
divideDecimal(if(equals(original_currency, currency), toDecimal64(currency_aware_amount, 10), if(dictGetOrDefault(`posthog_test`.`exchange_rate_dict`, 'rate', original_currency, toDate(ifNull(timestamp, toDateTime(0, 'UTC'))), toDecimal64(0, 10)) = 0, toDecimal64(0, 10), multiplyDecimal(divideDecimal(toDecimal64(currency_aware_amount, 10), dictGetOrDefault(`posthog_test`.`exchange_rate_dict`, 'rate', original_currency, toDate(ifNull(timestamp, toDateTime(0, 'UTC'))), toDecimal64(0, 10))), dictGetOrDefault(`posthog_test`.`exchange_rate_dict`, 'rate', currency, toDate(ifNull(timestamp, toDateTime(0, 'UTC'))), toDecimal64(0, 10))))), accurateCastOrNull(invoice.period_months, 'Decimal64(10)')) AS amount
|
||||
FROM
|
||||
(SELECT posthog_test_stripe_invoice.id AS id,
|
||||
parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC') AS created_at,
|
||||
posthog_test_stripe_invoice.customer AS customer_id,
|
||||
posthog_test_stripe_invoice.subscription AS subscription_id,
|
||||
posthog_test_stripe_invoice.discount AS discount,
|
||||
arrayJoin(JSONExtractArrayRaw(assumeNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(posthog_test_stripe_invoice.lines, 'data'), ''), 'null'), '^"|"$', '')))) AS data,
|
||||
JSONExtractString(data, 'id') AS invoice_item_id,
|
||||
JSONExtractString(data, 'amount') AS amount_captured,
|
||||
JSONExtractString(data, 'currency') AS currency,
|
||||
JSONExtractString(data, 'price', 'product') AS product_id,
|
||||
fromUnixTimestamp(JSONExtractUInt(data, 'period', 'start')) AS period_start,
|
||||
fromUnixTimestamp(JSONExtractUInt(data, 'period', 'end')) AS period_end,
|
||||
greatest(toInt16(round(divide(dateDiff('day', ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')), ifNull(period_end, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC'))), 30.44))), 1) AS period_months,
|
||||
arrayJoin(range(0, period_months)) AS month_index,
|
||||
ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestamp
|
||||
FROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice
|
||||
WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item ON equals(revenue_analytics_customer.id, revenue_analytics_revenue_item.customer_id)
|
||||
WHERE notEmpty(group_key)
|
||||
GROUP BY group_key) AS groups__revenue_analytics ON equals(groups.groups___key, groups__revenue_analytics.group_key)
|
||||
ORDER BY groups.key ASC
|
||||
LIMIT 100 SETTINGS readonly=2,
|
||||
max_execution_time=60,
|
||||
allow_experimental_object_type=1,
|
||||
format_csv_allow_double_quotes=1,
|
||||
max_ast_elements=4000000,
|
||||
max_expanded_ast_elements=4000000,
|
||||
max_bytes_before_external_group_by=0,
|
||||
transform_null_in=1,
|
||||
optimize_min_equality_disjunction_chain_length=4294967295,
|
||||
allow_experimental_join_condition=1
|
||||
'''
|
||||
# ---
|
||||
# name: TestRevenueAnalytics.test_get_revenue_for_schema_source_for_id_join.1
|
||||
'''
|
||||
SELECT groups.key AS key,
|
||||
groups__revenue_analytics.revenue AS `$virt_revenue`
|
||||
FROM
|
||||
(SELECT argMax(groups.group_key, toTimeZone(groups._timestamp, 'UTC')) AS groups___key,
|
||||
groups.group_type_index AS index,
|
||||
groups.group_key AS key
|
||||
FROM groups
|
||||
WHERE equals(groups.team_id, 99999)
|
||||
GROUP BY groups.group_type_index,
|
||||
groups.group_key) AS groups
|
||||
LEFT JOIN
|
||||
(SELECT 99999 AS team_id,
|
||||
arrayJoin([revenue_analytics_customer__groups.key]) AS group_key,
|
||||
sum(revenue_analytics_revenue_item.amount) AS revenue,
|
||||
sumIf(revenue_analytics_revenue_item.amount, ifNull(greaterOrEquals(revenue_analytics_revenue_item.timestamp, minus(today(), toIntervalDay(30))), 0)) AS revenue_last_30_days
|
||||
FROM
|
||||
(SELECT outer.id AS id,
|
||||
'stripe.posthog_test' AS source_label,
|
||||
parseDateTime64BestEffortOrNull(toString(outer.created), 6, 'UTC') AS timestamp,
|
||||
outer.name AS name,
|
||||
outer.email AS email,
|
||||
outer.phone AS phone,
|
||||
outer.address AS address,
|
||||
outer.metadata AS metadata,
|
||||
JSONExtractString(address, 'country') AS country,
|
||||
cohort_inner.cohort AS cohort,
|
||||
cohort_inner.initial_coupon AS initial_coupon,
|
||||
cohort_inner.initial_coupon_id AS initial_coupon_id
|
||||
FROM
|
||||
(SELECT *
|
||||
FROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_customers/posthog_test_stripe_customer/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `name` String, `email` String, `phone` String, `address` String, `created` DateTime, `metadata` String')) AS outer
|
||||
LEFT JOIN
|
||||
(SELECT invoice.customer AS customer_id,
|
||||
formatDateTime(toStartOfMonth(min(parseDateTime64BestEffortOrNull(toString(invoice.created), 6, 'UTC'))), '%Y-%m') AS cohort,
|
||||
argMin(JSONExtractString(invoice.discount, 'coupon', 'name'), parseDateTime64BestEffortOrNull(toString(invoice.created), 6, 'UTC')) AS initial_coupon,
|
||||
argMin(JSONExtractString(invoice.discount, 'coupon', 'id'), parseDateTime64BestEffortOrNull(toString(invoice.created), 6, 'UTC')) AS initial_coupon_id
|
||||
FROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS invoice
|
||||
GROUP BY invoice.customer) AS cohort_inner ON equals(cohort_inner.customer_id, outer.id)) AS revenue_analytics_customer GLOBAL
|
||||
LEFT JOIN
|
||||
(SELECT groups.key AS key,
|
||||
key AS revenue_analytics_customer__groups___key
|
||||
FROM
|
||||
(SELECT groups.group_type_index AS index,
|
||||
groups.group_key AS key
|
||||
FROM groups
|
||||
WHERE equals(groups.team_id, 99999)
|
||||
GROUP BY groups.group_type_index,
|
||||
groups.group_key) AS groups) AS revenue_analytics_customer__groups ON equals(revenue_analytics_customer.id, revenue_analytics_customer__groups.revenue_analytics_customer__groups___key)
|
||||
LEFT JOIN
|
||||
(SELECT if(ifNull(greater(invoice.period_months, 1), 0), concat(ifNull(toString(invoice.invoice_item_id), ''), '_', ifNull(toString(invoice.month_index), '')), invoice.invoice_item_id) AS id,
|
||||
invoice.invoice_item_id AS invoice_item_id,
|
||||
'stripe.posthog_test' AS source_label,
|
||||
addMonths(invoice.timestamp, invoice.month_index) AS timestamp,
|
||||
invoice.created_at AS created_at,
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
NULL AS event_name,
|
||||
JSONExtractString(invoice.discount, 'coupon', 'name') AS coupon,
|
||||
JSONExtractString(invoice.discount, 'coupon', 'id') AS coupon_id,
|
||||
upper(invoice.currency) AS original_currency,
|
||||
accurateCastOrNull(invoice.amount_captured, 'Decimal64(10)') AS original_amount,
|
||||
in(original_currency,
|
||||
['BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'UGX', 'VND', 'VUV', 'XAF', 'XOF', 'XPF']) AS enable_currency_aware_divider,
|
||||
if(enable_currency_aware_divider, accurateCastOrNull(1, 'Decimal64(10)'), accurateCastOrNull(100, 'Decimal64(10)')) AS currency_aware_divider,
|
||||
divideDecimal(original_amount, currency_aware_divider) AS currency_aware_amount,
|
||||
'GBP' AS currency,
|
||||
divideDecimal(if(equals(original_currency, currency), toDecimal64(currency_aware_amount, 10), if(dictGetOrDefault(`posthog_test`.`exchange_rate_dict`, 'rate', original_currency, toDate(ifNull(timestamp, toDateTime(0, 'UTC'))), toDecimal64(0, 10)) = 0, toDecimal64(0, 10), multiplyDecimal(divideDecimal(toDecimal64(currency_aware_amount, 10), dictGetOrDefault(`posthog_test`.`exchange_rate_dict`, 'rate', original_currency, toDate(ifNull(timestamp, toDateTime(0, 'UTC'))), toDecimal64(0, 10))), dictGetOrDefault(`posthog_test`.`exchange_rate_dict`, 'rate', currency, toDate(ifNull(timestamp, toDateTime(0, 'UTC'))), toDecimal64(0, 10))))), accurateCastOrNull(invoice.period_months, 'Decimal64(10)')) AS amount
|
||||
FROM
|
||||
(SELECT posthog_test_stripe_invoice.id AS id,
|
||||
parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC') AS created_at,
|
||||
posthog_test_stripe_invoice.customer AS customer_id,
|
||||
posthog_test_stripe_invoice.subscription AS subscription_id,
|
||||
posthog_test_stripe_invoice.discount AS discount,
|
||||
arrayJoin(JSONExtractArrayRaw(assumeNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(posthog_test_stripe_invoice.lines, 'data'), ''), 'null'), '^"|"$', '')))) AS data,
|
||||
JSONExtractString(data, 'id') AS invoice_item_id,
|
||||
JSONExtractString(data, 'amount') AS amount_captured,
|
||||
JSONExtractString(data, 'currency') AS currency,
|
||||
JSONExtractString(data, 'price', 'product') AS product_id,
|
||||
fromUnixTimestamp(JSONExtractUInt(data, 'period', 'start')) AS period_start,
|
||||
fromUnixTimestamp(JSONExtractUInt(data, 'period', 'end')) AS period_end,
|
||||
greatest(toInt16(round(divide(dateDiff('day', ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')), ifNull(period_end, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC'))), 30.44))), 1) AS period_months,
|
||||
arrayJoin(range(0, period_months)) AS month_index,
|
||||
ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestamp
|
||||
FROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice
|
||||
WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item ON equals(revenue_analytics_customer.id, revenue_analytics_revenue_item.customer_id)
|
||||
WHERE notEmpty(group_key)
|
||||
GROUP BY group_key) AS groups__revenue_analytics ON equals(groups.groups___key, groups__revenue_analytics.group_key)
|
||||
ORDER BY groups.key ASC
|
||||
LIMIT 100 SETTINGS readonly=2,
|
||||
max_execution_time=60,
|
||||
allow_experimental_object_type=1,
|
||||
format_csv_allow_double_quotes=1,
|
||||
max_ast_elements=4000000,
|
||||
max_expanded_ast_elements=4000000,
|
||||
max_bytes_before_external_group_by=0,
|
||||
transform_null_in=1,
|
||||
optimize_min_equality_disjunction_chain_length=4294967295,
|
||||
allow_experimental_join_condition=1
|
||||
'''
|
||||
# ---
|
||||
# name: TestRevenueAnalytics.test_get_revenue_for_schema_source_for_metadata_join
|
||||
'''
|
||||
SELECT groups.key AS key,
|
||||
groups__revenue_analytics.revenue AS revenue,
|
||||
groups__revenue_analytics.revenue AS `$virt_revenue`
|
||||
FROM
|
||||
(SELECT argMax(groups.group_key, toTimeZone(groups._timestamp, 'UTC')) AS groups___key,
|
||||
groups.group_type_index AS index,
|
||||
groups.group_key AS key
|
||||
FROM groups
|
||||
WHERE equals(groups.team_id, 99999)
|
||||
GROUP BY groups.group_type_index,
|
||||
groups.group_key) AS groups
|
||||
LEFT JOIN
|
||||
(SELECT 99999 AS team_id,
|
||||
arrayJoin([revenue_analytics_customer__groups.key]) AS group_key,
|
||||
sum(revenue_analytics_revenue_item.amount) AS revenue,
|
||||
sumIf(revenue_analytics_revenue_item.amount, ifNull(greaterOrEquals(revenue_analytics_revenue_item.timestamp, minus(today(), toIntervalDay(30))), 0)) AS revenue_last_30_days
|
||||
FROM
|
||||
(SELECT outer.id AS id,
|
||||
'stripe.posthog_test' AS source_label,
|
||||
parseDateTime64BestEffortOrNull(toString(outer.created), 6, 'UTC') AS timestamp,
|
||||
outer.name AS name,
|
||||
outer.email AS email,
|
||||
outer.phone AS phone,
|
||||
outer.address AS address,
|
||||
outer.metadata AS metadata,
|
||||
JSONExtractString(address, 'country') AS country,
|
||||
cohort_inner.cohort AS cohort,
|
||||
cohort_inner.initial_coupon AS initial_coupon,
|
||||
cohort_inner.initial_coupon_id AS initial_coupon_id
|
||||
FROM
|
||||
(SELECT *
|
||||
FROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_customers/posthog_test_stripe_customer/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `name` String, `email` String, `phone` String, `address` String, `created` DateTime, `metadata` String')) AS outer
|
||||
LEFT JOIN
|
||||
(SELECT invoice.customer AS customer_id,
|
||||
formatDateTime(toStartOfMonth(min(parseDateTime64BestEffortOrNull(toString(invoice.created), 6, 'UTC'))), '%Y-%m') AS cohort,
|
||||
argMin(JSONExtractString(invoice.discount, 'coupon', 'name'), parseDateTime64BestEffortOrNull(toString(invoice.created), 6, 'UTC')) AS initial_coupon,
|
||||
argMin(JSONExtractString(invoice.discount, 'coupon', 'id'), parseDateTime64BestEffortOrNull(toString(invoice.created), 6, 'UTC')) AS initial_coupon_id
|
||||
FROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS invoice
|
||||
GROUP BY invoice.customer) AS cohort_inner ON equals(cohort_inner.customer_id, outer.id)) AS revenue_analytics_customer GLOBAL
|
||||
LEFT JOIN
|
||||
(SELECT groups.key AS key,
|
||||
key AS revenue_analytics_customer__groups___key
|
||||
FROM
|
||||
(SELECT groups.group_type_index AS index,
|
||||
groups.group_key AS key
|
||||
FROM groups
|
||||
WHERE equals(groups.team_id, 99999)
|
||||
GROUP BY groups.group_type_index,
|
||||
groups.group_key) AS groups) AS revenue_analytics_customer__groups ON equals(JSONExtractString(revenue_analytics_customer.metadata, 'id'), revenue_analytics_customer__groups.revenue_analytics_customer__groups___key)
|
||||
LEFT JOIN
|
||||
(SELECT if(ifNull(greater(invoice.period_months, 1), 0), concat(ifNull(toString(invoice.invoice_item_id), ''), '_', ifNull(toString(invoice.month_index), '')), invoice.invoice_item_id) AS id,
|
||||
invoice.invoice_item_id AS invoice_item_id,
|
||||
'stripe.posthog_test' AS source_label,
|
||||
addMonths(invoice.timestamp, invoice.month_index) AS timestamp,
|
||||
invoice.created_at AS created_at,
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
NULL AS event_name,
|
||||
JSONExtractString(invoice.discount, 'coupon', 'name') AS coupon,
|
||||
JSONExtractString(invoice.discount, 'coupon', 'id') AS coupon_id,
|
||||
upper(invoice.currency) AS original_currency,
|
||||
accurateCastOrNull(invoice.amount_captured, 'Decimal64(10)') AS original_amount,
|
||||
in(original_currency,
|
||||
['BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'UGX', 'VND', 'VUV', 'XAF', 'XOF', 'XPF']) AS enable_currency_aware_divider,
|
||||
if(enable_currency_aware_divider, accurateCastOrNull(1, 'Decimal64(10)'), accurateCastOrNull(100, 'Decimal64(10)')) AS currency_aware_divider,
|
||||
divideDecimal(original_amount, currency_aware_divider) AS currency_aware_amount,
|
||||
'GBP' AS currency,
|
||||
divideDecimal(if(equals(original_currency, currency), toDecimal64(currency_aware_amount, 10), if(dictGetOrDefault(`posthog_test`.`exchange_rate_dict`, 'rate', original_currency, toDate(ifNull(timestamp, toDateTime(0, 'UTC'))), toDecimal64(0, 10)) = 0, toDecimal64(0, 10), multiplyDecimal(divideDecimal(toDecimal64(currency_aware_amount, 10), dictGetOrDefault(`posthog_test`.`exchange_rate_dict`, 'rate', original_currency, toDate(ifNull(timestamp, toDateTime(0, 'UTC'))), toDecimal64(0, 10))), dictGetOrDefault(`posthog_test`.`exchange_rate_dict`, 'rate', currency, toDate(ifNull(timestamp, toDateTime(0, 'UTC'))), toDecimal64(0, 10))))), accurateCastOrNull(invoice.period_months, 'Decimal64(10)')) AS amount
|
||||
FROM
|
||||
(SELECT posthog_test_stripe_invoice.id AS id,
|
||||
parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC') AS created_at,
|
||||
posthog_test_stripe_invoice.customer AS customer_id,
|
||||
posthog_test_stripe_invoice.subscription AS subscription_id,
|
||||
posthog_test_stripe_invoice.discount AS discount,
|
||||
arrayJoin(JSONExtractArrayRaw(assumeNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(posthog_test_stripe_invoice.lines, 'data'), ''), 'null'), '^"|"$', '')))) AS data,
|
||||
JSONExtractString(data, 'id') AS invoice_item_id,
|
||||
JSONExtractString(data, 'amount') AS amount_captured,
|
||||
JSONExtractString(data, 'currency') AS currency,
|
||||
JSONExtractString(data, 'price', 'product') AS product_id,
|
||||
fromUnixTimestamp(JSONExtractUInt(data, 'period', 'start')) AS period_start,
|
||||
fromUnixTimestamp(JSONExtractUInt(data, 'period', 'end')) AS period_end,
|
||||
greatest(toInt16(round(divide(dateDiff('day', ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')), ifNull(period_end, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC'))), 30.44))), 1) AS period_months,
|
||||
arrayJoin(range(0, period_months)) AS month_index,
|
||||
ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestamp
|
||||
FROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice
|
||||
WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item ON equals(revenue_analytics_customer.id, revenue_analytics_revenue_item.customer_id)
|
||||
WHERE notEmpty(group_key)
|
||||
GROUP BY group_key) AS groups__revenue_analytics ON equals(groups.groups___key, groups__revenue_analytics.group_key)
|
||||
ORDER BY groups.key ASC
|
||||
LIMIT 100 SETTINGS readonly=2,
|
||||
max_execution_time=60,
|
||||
allow_experimental_object_type=1,
|
||||
format_csv_allow_double_quotes=1,
|
||||
max_ast_elements=4000000,
|
||||
max_expanded_ast_elements=4000000,
|
||||
max_bytes_before_external_group_by=0,
|
||||
transform_null_in=1,
|
||||
optimize_min_equality_disjunction_chain_length=4294967295,
|
||||
allow_experimental_join_condition=1
|
||||
'''
|
||||
# ---
|
||||
# name: TestRevenueAnalytics.test_query_revenue_analytics_table_events
|
||||
'''
|
||||
SELECT groups_revenue_analytics.group_key AS group_key,
|
||||
groups_revenue_analytics.revenue AS revenue,
|
||||
groups_revenue_analytics.revenue_last_30_days AS revenue_last_30_days
|
||||
FROM
|
||||
(SELECT 99999 AS team_id,
|
||||
arrayJoin([revenue_analytics_revenue_item.group_0_key, revenue_analytics_revenue_item.group_1_key, revenue_analytics_revenue_item.group_2_key, revenue_analytics_revenue_item.group_3_key, revenue_analytics_revenue_item.group_4_key]) AS group_key,
|
||||
sum(revenue_analytics_revenue_item.amount) AS revenue,
|
||||
sumIf(revenue_analytics_revenue_item.amount, ifNull(greaterOrEquals(revenue_analytics_revenue_item.timestamp, minus(today(), toIntervalDay(30))), 0)) AS revenue_last_30_days
|
||||
FROM
|
||||
(SELECT toString(persons.id) AS id,
|
||||
'revenue_analytics.events.purchase' AS source_label,
|
||||
persons.created_at AS timestamp,
|
||||
persons.properties___name AS name,
|
||||
persons.properties___email AS email,
|
||||
persons.properties___phone AS phone,
|
||||
persons.properties___address AS address,
|
||||
persons.properties___metadata AS metadata,
|
||||
persons.`properties___$geoip_country_name` AS country,
|
||||
formatDateTime(toStartOfMonth(persons.created_at), '%Y-%m') AS cohort,
|
||||
NULL AS initial_coupon,
|
||||
NULL AS initial_coupon_id
|
||||
FROM
|
||||
(SELECT person.id AS id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'name'), ''), 'null'), '^"|"$', '') AS properties___name,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'email'), ''), 'null'), '^"|"$', '') AS properties___email,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'phone'), ''), 'null'), '^"|"$', '') AS properties___phone,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'address'), ''), 'null'), '^"|"$', '') AS properties___address,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'metadata'), ''), 'null'), '^"|"$', '') AS properties___metadata,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, '$geoip_country_name'), ''), 'null'), '^"|"$', '') AS `properties___$geoip_country_name`,
|
||||
toTimeZone(person.created_at, 'UTC') AS created_at
|
||||
FROM person
|
||||
WHERE and(equals(person.team_id, 99999), in(tuple(person.id, person.version),
|
||||
(SELECT person.id AS id, max(person.version) AS version
|
||||
FROM person
|
||||
WHERE equals(person.team_id, 99999)
|
||||
GROUP BY person.id
|
||||
HAVING and(ifNull(equals(argMax(person.is_deleted, person.version), 0), 0), ifNull(less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))), 0))
|
||||
ORDER BY argMax(toTimeZone(person.created_at, 'UTC'), person.version) DESC))) SETTINGS optimize_aggregation_in_order=1) AS persons
|
||||
INNER JOIN
|
||||
(SELECT DISTINCT events__person.id AS person_id
|
||||
FROM events
|
||||
LEFT OUTER JOIN
|
||||
(SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,
|
||||
person_distinct_id_overrides.distinct_id AS distinct_id
|
||||
FROM person_distinct_id_overrides
|
||||
WHERE equals(person_distinct_id_overrides.team_id, 99999)
|
||||
GROUP BY person_distinct_id_overrides.distinct_id
|
||||
HAVING ifNull(equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
|
||||
LEFT JOIN
|
||||
(SELECT person.id AS id
|
||||
FROM person
|
||||
WHERE equals(person.team_id, 99999)
|
||||
GROUP BY person.id
|
||||
HAVING and(ifNull(equals(argMax(person.is_deleted, person.version), 0), 0), ifNull(less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))), 0)) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id)
|
||||
WHERE and(equals(events.team_id, 99999), 1)) AS events ON equals(persons.id, events.person_id)
|
||||
ORDER BY persons.created_at DESC) AS revenue_analytics_customer
|
||||
LEFT JOIN
|
||||
(SELECT toString(events.uuid) AS id,
|
||||
toString(events.uuid) AS invoice_item_id,
|
||||
'revenue_analytics.events.purchase' AS source_label,
|
||||
toTimeZone(events.timestamp, 'UTC') AS timestamp,
|
||||
timestamp AS created_at,
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
events.event AS event_name,
|
||||
NULL AS coupon,
|
||||
coupon AS coupon_id,
|
||||
'USD' AS original_currency,
|
||||
accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Decimal64(10)') AS original_amount,
|
||||
in(original_currency,
|
||||
['BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'UGX', 'VND', 'VUV', 'XAF', 'XOF', 'XPF']) AS enable_currency_aware_divider,
|
||||
if(enable_currency_aware_divider, accurateCastOrNull(1, 'Decimal64(10)'), accurateCastOrNull(100, 'Decimal64(10)')) AS currency_aware_divider,
|
||||
divideDecimal(original_amount, currency_aware_divider) AS currency_aware_amount,
|
||||
'USD' AS currency,
|
||||
if(isNull('USD'), accurateCastOrNull(currency_aware_amount, 'Decimal64(10)'), if(equals('USD', 'USD'), toDecimal64(currency_aware_amount, 10), if(dictGetOrDefault(`posthog_test`.`exchange_rate_dict`, 'rate', 'USD', toDate(toTimeZone(events.timestamp, 'UTC')), toDecimal64(0, 10)) = 0, toDecimal64(0, 10), multiplyDecimal(divideDecimal(toDecimal64(currency_aware_amount, 10), dictGetOrDefault(`posthog_test`.`exchange_rate_dict`, 'rate', 'USD', toDate(toTimeZone(events.timestamp, 'UTC')), toDecimal64(0, 10))), dictGetOrDefault(`posthog_test`.`exchange_rate_dict`, 'rate', 'USD', toDate(toTimeZone(events.timestamp, 'UTC')), toDecimal64(0, 10)))))) AS amount
|
||||
FROM events
|
||||
LEFT OUTER JOIN
|
||||
(SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,
|
||||
person_distinct_id_overrides.distinct_id AS distinct_id
|
||||
FROM person_distinct_id_overrides
|
||||
WHERE equals(person_distinct_id_overrides.team_id, 99999)
|
||||
GROUP BY person_distinct_id_overrides.distinct_id
|
||||
HAVING ifNull(equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
|
||||
WHERE and(equals(events.team_id, 99999), and(equals(events.event, 'purchase'), 1, isNotNull(amount)))
|
||||
ORDER BY timestamp DESC) AS revenue_analytics_revenue_item ON equals(revenue_analytics_customer.id, revenue_analytics_revenue_item.customer_id)
|
||||
WHERE notEmpty(group_key)
|
||||
GROUP BY group_key) AS groups_revenue_analytics
|
||||
ORDER BY groups_revenue_analytics.group_key ASC
|
||||
LIMIT 100 SETTINGS readonly=2,
|
||||
max_execution_time=60,
|
||||
allow_experimental_object_type=1,
|
||||
format_csv_allow_double_quotes=1,
|
||||
max_ast_elements=4000000,
|
||||
max_expanded_ast_elements=4000000,
|
||||
max_bytes_before_external_group_by=0,
|
||||
transform_null_in=1,
|
||||
optimize_min_equality_disjunction_chain_length=4294967295,
|
||||
allow_experimental_join_condition=1
|
||||
'''
|
||||
# ---
|
||||
# name: TestRevenueAnalytics.test_query_revenue_analytics_table_sources
|
||||
'''
|
||||
SELECT groups_revenue_analytics.group_key AS group_key,
|
||||
groups_revenue_analytics.revenue AS revenue,
|
||||
groups_revenue_analytics.revenue_last_30_days AS revenue_last_30_days
|
||||
FROM
|
||||
(SELECT 99999 AS team_id,
|
||||
arrayJoin([revenue_analytics_customer__groups.key]) AS group_key,
|
||||
sum(revenue_analytics_revenue_item.amount) AS revenue,
|
||||
sumIf(revenue_analytics_revenue_item.amount, ifNull(greaterOrEquals(revenue_analytics_revenue_item.timestamp, minus(today(), toIntervalDay(30))), 0)) AS revenue_last_30_days
|
||||
FROM
|
||||
(SELECT outer.id AS id,
|
||||
'stripe.posthog_test' AS source_label,
|
||||
parseDateTime64BestEffortOrNull(toString(outer.created), 6, 'UTC') AS timestamp,
|
||||
outer.name AS name,
|
||||
outer.email AS email,
|
||||
outer.phone AS phone,
|
||||
outer.address AS address,
|
||||
outer.metadata AS metadata,
|
||||
JSONExtractString(address, 'country') AS country,
|
||||
cohort_inner.cohort AS cohort,
|
||||
cohort_inner.initial_coupon AS initial_coupon,
|
||||
cohort_inner.initial_coupon_id AS initial_coupon_id
|
||||
FROM
|
||||
(SELECT *
|
||||
FROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_customers/posthog_test_stripe_customer/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `name` String, `email` String, `phone` String, `address` String, `created` DateTime, `metadata` String')) AS outer
|
||||
LEFT JOIN
|
||||
(SELECT invoice.customer AS customer_id,
|
||||
formatDateTime(toStartOfMonth(min(parseDateTime64BestEffortOrNull(toString(invoice.created), 6, 'UTC'))), '%Y-%m') AS cohort,
|
||||
argMin(JSONExtractString(invoice.discount, 'coupon', 'name'), parseDateTime64BestEffortOrNull(toString(invoice.created), 6, 'UTC')) AS initial_coupon,
|
||||
argMin(JSONExtractString(invoice.discount, 'coupon', 'id'), parseDateTime64BestEffortOrNull(toString(invoice.created), 6, 'UTC')) AS initial_coupon_id
|
||||
FROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS invoice
|
||||
GROUP BY invoice.customer) AS cohort_inner ON equals(cohort_inner.customer_id, outer.id)) AS revenue_analytics_customer GLOBAL
|
||||
LEFT JOIN
|
||||
(SELECT groups.key AS key,
|
||||
key AS revenue_analytics_customer__groups___key
|
||||
FROM
|
||||
(SELECT groups.group_type_index AS index,
|
||||
groups.group_key AS key
|
||||
FROM groups
|
||||
WHERE equals(groups.team_id, 99999)
|
||||
GROUP BY groups.group_type_index,
|
||||
groups.group_key) AS groups) AS revenue_analytics_customer__groups ON equals(revenue_analytics_customer.email, revenue_analytics_customer__groups.revenue_analytics_customer__groups___key)
|
||||
LEFT JOIN
|
||||
(SELECT if(ifNull(greater(invoice.period_months, 1), 0), concat(ifNull(toString(invoice.invoice_item_id), ''), '_', ifNull(toString(invoice.month_index), '')), invoice.invoice_item_id) AS id,
|
||||
invoice.invoice_item_id AS invoice_item_id,
|
||||
'stripe.posthog_test' AS source_label,
|
||||
addMonths(invoice.timestamp, invoice.month_index) AS timestamp,
|
||||
invoice.created_at AS created_at,
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
NULL AS event_name,
|
||||
JSONExtractString(invoice.discount, 'coupon', 'name') AS coupon,
|
||||
JSONExtractString(invoice.discount, 'coupon', 'id') AS coupon_id,
|
||||
upper(invoice.currency) AS original_currency,
|
||||
accurateCastOrNull(invoice.amount_captured, 'Decimal64(10)') AS original_amount,
|
||||
in(original_currency,
|
||||
['BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'UGX', 'VND', 'VUV', 'XAF', 'XOF', 'XPF']) AS enable_currency_aware_divider,
|
||||
if(enable_currency_aware_divider, accurateCastOrNull(1, 'Decimal64(10)'), accurateCastOrNull(100, 'Decimal64(10)')) AS currency_aware_divider,
|
||||
divideDecimal(original_amount, currency_aware_divider) AS currency_aware_amount,
|
||||
'GBP' AS currency,
|
||||
divideDecimal(if(equals(original_currency, currency), toDecimal64(currency_aware_amount, 10), if(dictGetOrDefault(`posthog_test`.`exchange_rate_dict`, 'rate', original_currency, toDate(ifNull(timestamp, toDateTime(0, 'UTC'))), toDecimal64(0, 10)) = 0, toDecimal64(0, 10), multiplyDecimal(divideDecimal(toDecimal64(currency_aware_amount, 10), dictGetOrDefault(`posthog_test`.`exchange_rate_dict`, 'rate', original_currency, toDate(ifNull(timestamp, toDateTime(0, 'UTC'))), toDecimal64(0, 10))), dictGetOrDefault(`posthog_test`.`exchange_rate_dict`, 'rate', currency, toDate(ifNull(timestamp, toDateTime(0, 'UTC'))), toDecimal64(0, 10))))), accurateCastOrNull(invoice.period_months, 'Decimal64(10)')) AS amount
|
||||
FROM
|
||||
(SELECT posthog_test_stripe_invoice.id AS id,
|
||||
parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC') AS created_at,
|
||||
posthog_test_stripe_invoice.customer AS customer_id,
|
||||
posthog_test_stripe_invoice.subscription AS subscription_id,
|
||||
posthog_test_stripe_invoice.discount AS discount,
|
||||
arrayJoin(JSONExtractArrayRaw(assumeNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(posthog_test_stripe_invoice.lines, 'data'), ''), 'null'), '^"|"$', '')))) AS data,
|
||||
JSONExtractString(data, 'id') AS invoice_item_id,
|
||||
JSONExtractString(data, 'amount') AS amount_captured,
|
||||
JSONExtractString(data, 'currency') AS currency,
|
||||
JSONExtractString(data, 'price', 'product') AS product_id,
|
||||
fromUnixTimestamp(JSONExtractUInt(data, 'period', 'start')) AS period_start,
|
||||
fromUnixTimestamp(JSONExtractUInt(data, 'period', 'end')) AS period_end,
|
||||
greatest(toInt16(round(divide(dateDiff('day', ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')), ifNull(period_end, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC'))), 30.44))), 1) AS period_months,
|
||||
arrayJoin(range(0, period_months)) AS month_index,
|
||||
ifNull(period_start, parseDateTime64BestEffortOrNull(toString(posthog_test_stripe_invoice.created), 6, 'UTC')) AS timestamp
|
||||
FROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices/posthog_test_stripe_invoice/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `tax` Int64, `paid` UInt8, `lines` String, `total` Int64, `charge` String, `issuer` String, `number` String, `object` String, `status` String, `created` DateTime, `currency` String, `customer` String, `discount` String, `due_date` DateTime, `livemode` UInt8, `metadata` String, `subtotal` Int64, `attempted` UInt8, `discounts` String, `rendering` String, `amount_due` Int64, `amount_paid` Int64, `description` String, `invoice_pdf` String, `account_name` String, `auto_advance` UInt8, `effective_at` DateTime, `subscription` String, `attempt_count` UInt8, `automatic_tax` String, `customer_name` String, `period_end_at` DateTime, `billing_reason` String, `customer_email` String, `ending_balance` Int64, `payment_intent` String, `account_country` String, `amount_shipping` Int64, `period_start_at` DateTime, `amount_remaining` Int64, `customer_address` String, `customer_tax_ids` String, `paid_out_of_band` UInt8, `payment_settings` String, `starting_balance` Int64, `collection_method` String, `default_tax_rates` String, `total_tax_amounts` String, `hosted_invoice_url` String, `status_transitions` String, `customer_tax_exempt` String, `total_excluding_tax` Int64, `subscription_details` String, `webhooks_delivered_at` DateTime, `subtotal_excluding_tax` Int64, `total_discount_amounts` String, `pre_payment_credit_notes_amount` Int64, `post_payment_credit_notes_amount` Int64') AS posthog_test_stripe_invoice
|
||||
WHERE posthog_test_stripe_invoice.paid) AS invoice) AS revenue_analytics_revenue_item ON equals(revenue_analytics_customer.id, revenue_analytics_revenue_item.customer_id)
|
||||
WHERE notEmpty(group_key)
|
||||
GROUP BY group_key) AS groups_revenue_analytics
|
||||
ORDER BY groups_revenue_analytics.group_key ASC
|
||||
LIMIT 100 SETTINGS readonly=2,
|
||||
max_execution_time=60,
|
||||
allow_experimental_object_type=1,
|
||||
format_csv_allow_double_quotes=1,
|
||||
max_ast_elements=4000000,
|
||||
max_expanded_ast_elements=4000000,
|
||||
max_bytes_before_external_group_by=0,
|
||||
transform_null_in=1,
|
||||
optimize_min_equality_disjunction_chain_length=4294967295,
|
||||
allow_experimental_join_condition=1
|
||||
'''
|
||||
# ---
|
||||
@@ -75,6 +75,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -178,6 +183,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -288,6 +298,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -400,6 +415,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -511,6 +531,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -622,6 +647,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -734,6 +764,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -839,6 +874,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1000,6 +1040,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
toString(events__pdi.person_id) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1134,6 +1179,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
toString(events.person_id) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1275,6 +1325,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1436,6 +1491,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
|
||||
@@ -0,0 +1,381 @@
|
||||
from decimal import Decimal
|
||||
from pathlib import Path
|
||||
|
||||
from freezegun import freeze_time
|
||||
from posthog.test.base import (
|
||||
APIBaseTest,
|
||||
ClickhouseTestMixin,
|
||||
_create_event,
|
||||
_create_person,
|
||||
snapshot_clickhouse_queries,
|
||||
)
|
||||
|
||||
from posthog.schema import CurrencyCode, HogQLQueryModifiers, RevenueAnalyticsEventItem, RevenueCurrencyPropertyConfig
|
||||
|
||||
from posthog.hogql import ast
|
||||
from posthog.hogql.parser import parse_select
|
||||
from posthog.hogql.query import execute_hogql_query
|
||||
|
||||
from posthog.models.group.util import create_group
|
||||
from posthog.models.group_type_mapping import GroupTypeMapping
|
||||
from posthog.temporal.data_imports.sources.stripe.constants import (
|
||||
CUSTOMER_RESOURCE_NAME as STRIPE_CUSTOMER_RESOURCE_NAME,
|
||||
INVOICE_RESOURCE_NAME as STRIPE_INVOICE_RESOURCE_NAME,
|
||||
)
|
||||
from posthog.warehouse.models import DataWarehouseJoin, ExternalDataSchema
|
||||
from posthog.warehouse.test.utils import create_data_warehouse_table_from_csv
|
||||
|
||||
from products.revenue_analytics.backend.hogql_queries.test.data.structure import (
|
||||
STRIPE_CUSTOMER_COLUMNS,
|
||||
STRIPE_INVOICE_COLUMNS,
|
||||
)
|
||||
from products.revenue_analytics.backend.views.schemas.customer import SCHEMA
|
||||
|
||||
INVOICES_TEST_BUCKET = "test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_invoices"
|
||||
CUSTOMERS_TEST_BUCKET = "test_storage_bucket-posthog.revenue_analytics.insights_query_runner.stripe_customers"
|
||||
|
||||
|
||||
@snapshot_clickhouse_queries
|
||||
class TestRevenueAnalytics(ClickhouseTestMixin, APIBaseTest):
|
||||
PURCHASE_EVENT_NAME = "purchase"
|
||||
REVENUE_PROPERTY = "revenue"
|
||||
QUERY_TIMESTAMP = "2025-05-30"
|
||||
MODIFIERS = HogQLQueryModifiers(formatCsvAllowDoubleQuotes=True)
|
||||
|
||||
person_id = "00000000-0000-0000-0000-000000000000"
|
||||
group0_id = "lolol0:xxx"
|
||||
group1_id = "lolol1:xxx"
|
||||
another_group0_id = "lolol1:xxx2"
|
||||
distinct_id = "distinct_id"
|
||||
|
||||
def tearDown(self):
|
||||
if hasattr(self, "invoices_cleanup_filesystem"):
|
||||
self.invoices_cleanup_filesystem()
|
||||
if hasattr(self, "customers_cleanup_filesystem"):
|
||||
self.customers_cleanup_filesystem()
|
||||
super().tearDown()
|
||||
|
||||
def setup_events(self):
|
||||
create_group(
|
||||
team_id=self.team.pk,
|
||||
group_type_index=0,
|
||||
group_key=self.group0_id,
|
||||
properties={"industry": "positive"},
|
||||
)
|
||||
create_group(
|
||||
team_id=self.team.pk,
|
||||
group_type_index=0,
|
||||
group_key=self.another_group0_id,
|
||||
properties={"industry": "another"},
|
||||
)
|
||||
create_group(
|
||||
team_id=self.team.pk,
|
||||
group_type_index=1,
|
||||
group_key=self.group1_id,
|
||||
properties={"industry": "negative"},
|
||||
)
|
||||
|
||||
_create_person(
|
||||
uuid=self.person_id,
|
||||
team_id=self.team.pk,
|
||||
distinct_ids=[self.distinct_id],
|
||||
)
|
||||
|
||||
_create_event(
|
||||
event="$pageview",
|
||||
team=self.team,
|
||||
distinct_id=self.distinct_id,
|
||||
timestamp=self.QUERY_TIMESTAMP,
|
||||
properties={"$group_0": self.group0_id},
|
||||
)
|
||||
|
||||
_create_event(
|
||||
event=self.PURCHASE_EVENT_NAME,
|
||||
team=self.team,
|
||||
distinct_id=self.distinct_id,
|
||||
timestamp=self.QUERY_TIMESTAMP,
|
||||
properties={self.REVENUE_PROPERTY: 25042, "$group_0": self.group0_id},
|
||||
)
|
||||
|
||||
_create_event(
|
||||
event=self.PURCHASE_EVENT_NAME,
|
||||
team=self.team,
|
||||
distinct_id=self.distinct_id,
|
||||
timestamp=self.QUERY_TIMESTAMP,
|
||||
properties={self.REVENUE_PROPERTY: 12500, "$group_1": self.group1_id},
|
||||
)
|
||||
|
||||
_create_event(
|
||||
event=self.PURCHASE_EVENT_NAME,
|
||||
team=self.team,
|
||||
distinct_id=self.distinct_id,
|
||||
timestamp=self.QUERY_TIMESTAMP,
|
||||
properties={self.REVENUE_PROPERTY: 10000, "$group_0": self.group0_id, "$group_1": self.group1_id},
|
||||
)
|
||||
|
||||
_create_event(
|
||||
event=self.PURCHASE_EVENT_NAME,
|
||||
team=self.team,
|
||||
distinct_id=self.distinct_id,
|
||||
timestamp=self.QUERY_TIMESTAMP,
|
||||
properties={self.REVENUE_PROPERTY: 3223, "$group_0": self.another_group0_id},
|
||||
)
|
||||
|
||||
def setup_schema_sources(self):
|
||||
invoices_csv_path = Path("products/revenue_analytics/backend/hogql_queries/test/data/stripe_invoices.csv")
|
||||
invoices_table, source, credential, _, self.invoices_cleanup_filesystem = create_data_warehouse_table_from_csv(
|
||||
invoices_csv_path,
|
||||
"stripe_invoice",
|
||||
STRIPE_INVOICE_COLUMNS,
|
||||
INVOICES_TEST_BUCKET,
|
||||
self.team,
|
||||
)
|
||||
|
||||
customers_csv_path = Path("products/revenue_analytics/backend/hogql_queries/test/data/stripe_customers.csv")
|
||||
customers_table, _, _, _, self.customers_cleanup_filesystem = create_data_warehouse_table_from_csv(
|
||||
customers_csv_path,
|
||||
"stripe_customer",
|
||||
STRIPE_CUSTOMER_COLUMNS,
|
||||
CUSTOMERS_TEST_BUCKET,
|
||||
self.team,
|
||||
source=source,
|
||||
credential=credential,
|
||||
)
|
||||
|
||||
# Besides the default creations above, also create the external data schema
|
||||
# because this is required by the `RevenueAnalyticsBaseView` to find the right tables
|
||||
_invoices_schema = ExternalDataSchema.objects.create(
|
||||
team=self.team,
|
||||
name=STRIPE_INVOICE_RESOURCE_NAME,
|
||||
source=source,
|
||||
table=invoices_table,
|
||||
should_sync=True,
|
||||
last_synced_at="2024-01-01",
|
||||
)
|
||||
|
||||
_customers_schema = ExternalDataSchema.objects.create(
|
||||
team=self.team,
|
||||
name=STRIPE_CUSTOMER_RESOURCE_NAME,
|
||||
source=source,
|
||||
table=customers_table,
|
||||
should_sync=True,
|
||||
last_synced_at="2024-01-01",
|
||||
)
|
||||
|
||||
self._setup_join()
|
||||
self.team.base_currency = CurrencyCode.GBP.value
|
||||
self.team.save()
|
||||
|
||||
def _setup_join(self):
|
||||
# Create some mappings
|
||||
GroupTypeMapping.objects.create(
|
||||
team=self.team, project_id=self.team.project_id, group_type="organization", group_type_index=0
|
||||
)
|
||||
GroupTypeMapping.objects.create(
|
||||
team=self.team, project_id=self.team.project_id, group_type="company", group_type_index=1
|
||||
)
|
||||
|
||||
self.join = DataWarehouseJoin.objects.create(
|
||||
team=self.team,
|
||||
source_table_name=f"stripe.posthog_test.{SCHEMA.source_suffix}",
|
||||
source_table_key="id",
|
||||
joining_table_name="groups",
|
||||
joining_table_key="key",
|
||||
field_name="groups",
|
||||
)
|
||||
|
||||
def test_get_revenue_for_events(self):
|
||||
self.setup_events()
|
||||
|
||||
self.team.revenue_analytics_config.events = [
|
||||
RevenueAnalyticsEventItem(
|
||||
eventName=self.PURCHASE_EVENT_NAME,
|
||||
revenueProperty=self.REVENUE_PROPERTY,
|
||||
revenueCurrencyProperty=RevenueCurrencyPropertyConfig(static="USD"),
|
||||
currencyAwareDecimal=True,
|
||||
)
|
||||
]
|
||||
self.team.revenue_analytics_config.save()
|
||||
self.team.save()
|
||||
|
||||
with freeze_time(self.QUERY_TIMESTAMP):
|
||||
response = execute_hogql_query(
|
||||
parse_select(
|
||||
"SELECT key, revenue_analytics.revenue, $virt_revenue FROM groups where key = {key}",
|
||||
placeholders={"key": ast.Constant(value=self.group0_id)},
|
||||
),
|
||||
self.team,
|
||||
)
|
||||
|
||||
self.assertEqual(response.results, [(self.group0_id, Decimal("350.42"), Decimal("350.42"))])
|
||||
|
||||
def test_get_revenue_for_schema_source_for_id_join(self):
|
||||
self.setup_schema_sources()
|
||||
self.join.source_table_key = "id"
|
||||
self.join.save()
|
||||
|
||||
# These are the 6 IDs inside the CSV files, plus an extra dummy/empty one
|
||||
for key in ["cus_1", "cus_2", "cus_3", "cus_4", "cus_5", "cus_6", "dummy"]:
|
||||
create_group(team_id=self.team.pk, group_type_index=0, group_key=key)
|
||||
|
||||
with freeze_time(self.QUERY_TIMESTAMP):
|
||||
queries = [
|
||||
"SELECT key, revenue_analytics.revenue FROM groups ORDER BY key ASC",
|
||||
"SELECT key, $virt_revenue FROM groups ORDER BY key ASC",
|
||||
]
|
||||
|
||||
for query in queries:
|
||||
response = execute_hogql_query(parse_select(query), self.team, modifiers=self.MODIFIERS)
|
||||
|
||||
self.assertEqual(
|
||||
response.results,
|
||||
[
|
||||
("cus_1", Decimal("429.7423999996")),
|
||||
("cus_2", Decimal("477.2037499988")),
|
||||
("cus_3", Decimal("4171.09153")),
|
||||
("cus_4", Decimal("254.12345")),
|
||||
("cus_5", Decimal("1529.9212")),
|
||||
("cus_6", Decimal("2796.37014")),
|
||||
("dummy", None),
|
||||
],
|
||||
)
|
||||
|
||||
def test_get_revenue_for_schema_source_for_email_join(self):
|
||||
self.setup_schema_sources()
|
||||
self.join.source_table_key = "email"
|
||||
self.join.save()
|
||||
|
||||
# These are the 6 IDs inside the CSV files, and we have an extra empty one
|
||||
for key in [
|
||||
"john.doe@example.com", # cus_1
|
||||
"jane.doe@example.com", # cus_2
|
||||
"john.smith@example.com", # cus_3
|
||||
"jane.smith@example.com", # cus_4
|
||||
"john.doejr@example.com", # cus_5
|
||||
"john.doejrjr@example.com", # cus_6
|
||||
"zdummy",
|
||||
]:
|
||||
create_group(team_id=self.team.pk, group_type_index=0, group_key=key)
|
||||
|
||||
with freeze_time(self.QUERY_TIMESTAMP):
|
||||
response = execute_hogql_query(
|
||||
parse_select("SELECT key, revenue_analytics.revenue, $virt_revenue FROM groups ORDER BY key ASC"),
|
||||
self.team,
|
||||
modifiers=self.MODIFIERS,
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
response.results,
|
||||
[
|
||||
("jane.doe@example.com", Decimal("477.2037499988"), Decimal("477.2037499988")),
|
||||
("jane.smith@example.com", Decimal("254.12345"), Decimal("254.12345")),
|
||||
("john.doe@example.com", Decimal("429.7423999996"), Decimal("429.7423999996")),
|
||||
("john.doejr@example.com", Decimal("1529.9212"), Decimal("1529.9212")),
|
||||
("john.doejrjr@example.com", Decimal("2796.37014"), Decimal("2796.37014")),
|
||||
("john.smith@example.com", Decimal("4171.09153"), Decimal("4171.09153")),
|
||||
("zdummy", None, None),
|
||||
],
|
||||
)
|
||||
|
||||
def test_get_revenue_for_schema_source_for_metadata_join(self):
|
||||
self.setup_schema_sources()
|
||||
self.join.source_table_key = "JSONExtractString(metadata, 'id')"
|
||||
self.join.save()
|
||||
|
||||
# These are the 6 IDs inside the CSV files, and we have an extra empty one
|
||||
for key in [
|
||||
"cus_1_metadata",
|
||||
"cus_2_metadata",
|
||||
"cus_3_metadata",
|
||||
"cus_4_metadata",
|
||||
"cus_5_metadata",
|
||||
"cus_6_metadata",
|
||||
"dummy",
|
||||
]:
|
||||
create_group(team_id=self.team.pk, group_type_index=0, group_key=key)
|
||||
|
||||
with freeze_time(self.QUERY_TIMESTAMP):
|
||||
response = execute_hogql_query(
|
||||
parse_select("SELECT key, revenue_analytics.revenue, $virt_revenue FROM groups ORDER BY key ASC"),
|
||||
self.team,
|
||||
modifiers=self.MODIFIERS,
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
response.results,
|
||||
[
|
||||
("cus_1_metadata", Decimal("429.7423999996"), Decimal("429.7423999996")),
|
||||
("cus_2_metadata", Decimal("477.2037499988"), Decimal("477.2037499988")),
|
||||
("cus_3_metadata", Decimal("4171.09153"), Decimal("4171.09153")),
|
||||
("cus_4_metadata", Decimal("254.12345"), Decimal("254.12345")),
|
||||
("cus_5_metadata", Decimal("1529.9212"), Decimal("1529.9212")),
|
||||
("cus_6_metadata", Decimal("2796.37014"), Decimal("2796.37014")),
|
||||
("dummy", None, None),
|
||||
],
|
||||
)
|
||||
|
||||
def test_query_revenue_analytics_table_sources(self):
|
||||
self.setup_schema_sources()
|
||||
self.join.source_table_key = "email"
|
||||
self.join.save()
|
||||
|
||||
# These are the 6 IDs inside the CSV files, and we have an extra empty one
|
||||
for key in [
|
||||
"john.doe@example.com", # cus_1
|
||||
"jane.doe@example.com", # cus_2
|
||||
"john.smith@example.com", # cus_3
|
||||
"jane.smith@example.com", # cus_4
|
||||
"john.doejr@example.com", # cus_5
|
||||
"john.doejrjr@example.com", # cus_6
|
||||
"zdummy",
|
||||
]:
|
||||
create_group(team_id=self.team.pk, group_type_index=0, group_key=key)
|
||||
|
||||
with freeze_time(self.QUERY_TIMESTAMP):
|
||||
results = execute_hogql_query(
|
||||
parse_select("SELECT * FROM groups_revenue_analytics ORDER BY group_key ASC"),
|
||||
self.team,
|
||||
modifiers=self.MODIFIERS,
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
results.results,
|
||||
[
|
||||
("jane.doe@example.com", Decimal("477.2037499988"), Decimal("130.0504749995")),
|
||||
("jane.smith@example.com", Decimal("254.12345"), None),
|
||||
("john.doe@example.com", Decimal("429.7423999996"), Decimal("41.0122916665")),
|
||||
("john.doejr@example.com", Decimal("1529.9212"), None),
|
||||
("john.doejrjr@example.com", Decimal("2796.37014"), None),
|
||||
("john.smith@example.com", Decimal("4171.09153"), None),
|
||||
],
|
||||
)
|
||||
|
||||
def test_query_revenue_analytics_table_events(self):
|
||||
self.setup_events()
|
||||
|
||||
self.team.revenue_analytics_config.events = [
|
||||
RevenueAnalyticsEventItem(
|
||||
eventName=self.PURCHASE_EVENT_NAME,
|
||||
revenueProperty=self.REVENUE_PROPERTY,
|
||||
revenueCurrencyProperty=RevenueCurrencyPropertyConfig(static="USD"),
|
||||
currencyAwareDecimal=True,
|
||||
)
|
||||
]
|
||||
self.team.revenue_analytics_config.save()
|
||||
self.team.save()
|
||||
|
||||
with freeze_time(self.QUERY_TIMESTAMP):
|
||||
results = execute_hogql_query(
|
||||
parse_select("SELECT * FROM groups_revenue_analytics ORDER BY group_key ASC"),
|
||||
self.team,
|
||||
modifiers=self.MODIFIERS,
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
results.results,
|
||||
[
|
||||
("lolol0:xxx", Decimal("350.42"), None),
|
||||
("lolol1:xxx", Decimal("225"), None),
|
||||
("lolol1:xxx2", Decimal("32.23"), None),
|
||||
],
|
||||
)
|
||||
@@ -132,7 +132,6 @@ class TestRevenueAnalytics(ClickhouseTestMixin, APIBaseTest):
|
||||
last_synced_at="2024-01-01",
|
||||
)
|
||||
|
||||
# We also need a join between the persons table and the view
|
||||
self.join = DataWarehouseJoin.objects.create(
|
||||
team=self.team,
|
||||
source_table_name=f"stripe.posthog_test.{SCHEMA.source_suffix}",
|
||||
@@ -172,7 +171,6 @@ class TestRevenueAnalytics(ClickhouseTestMixin, APIBaseTest):
|
||||
|
||||
def test_get_revenue_for_schema_source_for_id_join(self):
|
||||
self.setup_schema_sources()
|
||||
|
||||
self.join.source_table_key = "id"
|
||||
self.join.save()
|
||||
|
||||
@@ -206,7 +204,6 @@ class TestRevenueAnalytics(ClickhouseTestMixin, APIBaseTest):
|
||||
|
||||
def test_get_revenue_for_schema_source_for_email_join(self):
|
||||
self.setup_schema_sources()
|
||||
|
||||
self.join.source_table_key = "email"
|
||||
self.join.save()
|
||||
|
||||
@@ -258,7 +255,6 @@ class TestRevenueAnalytics(ClickhouseTestMixin, APIBaseTest):
|
||||
|
||||
def test_get_revenue_for_schema_source_for_metadata_join(self):
|
||||
self.setup_schema_sources()
|
||||
|
||||
self.join.source_table_key = "JSONExtractString(metadata, 'id')"
|
||||
self.join.save()
|
||||
|
||||
@@ -298,7 +294,6 @@ class TestRevenueAnalytics(ClickhouseTestMixin, APIBaseTest):
|
||||
|
||||
def test_get_revenue_for_schema_source_for_customer_with_multiple_distinct_ids(self):
|
||||
self.setup_schema_sources()
|
||||
|
||||
self.join.source_table_key = "email"
|
||||
self.join.save()
|
||||
|
||||
|
||||
@@ -1136,7 +1136,8 @@
|
||||
"key",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"properties"
|
||||
"properties",
|
||||
"revenue_analytics"
|
||||
],
|
||||
"hogql_value": "group_0",
|
||||
"id": "group_0",
|
||||
@@ -1163,7 +1164,8 @@
|
||||
"key",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"properties"
|
||||
"properties",
|
||||
"revenue_analytics"
|
||||
],
|
||||
"hogql_value": "group_1",
|
||||
"id": "group_1",
|
||||
@@ -1190,7 +1192,8 @@
|
||||
"key",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"properties"
|
||||
"properties",
|
||||
"revenue_analytics"
|
||||
],
|
||||
"hogql_value": "group_2",
|
||||
"id": "group_2",
|
||||
@@ -1217,7 +1220,8 @@
|
||||
"key",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"properties"
|
||||
"properties",
|
||||
"revenue_analytics"
|
||||
],
|
||||
"hogql_value": "group_3",
|
||||
"id": "group_3",
|
||||
@@ -1244,7 +1248,8 @@
|
||||
"key",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"properties"
|
||||
"properties",
|
||||
"revenue_analytics"
|
||||
],
|
||||
"hogql_value": "group_4",
|
||||
"id": "group_4",
|
||||
@@ -1469,6 +1474,47 @@
|
||||
"schema_valid": true,
|
||||
"table": null,
|
||||
"type": "json"
|
||||
},
|
||||
"revenue_analytics": {
|
||||
"chain": null,
|
||||
"fields": [
|
||||
"team_id",
|
||||
"group_key",
|
||||
"revenue",
|
||||
"revenue_last_30_days"
|
||||
],
|
||||
"hogql_value": "revenue_analytics",
|
||||
"id": "revenue_analytics",
|
||||
"name": "revenue_analytics",
|
||||
"schema_valid": true,
|
||||
"table": "groups_revenue_analytics",
|
||||
"type": "lazy_table"
|
||||
},
|
||||
"$virt_revenue": {
|
||||
"chain": [
|
||||
"revenue_analytics",
|
||||
"revenue"
|
||||
],
|
||||
"fields": null,
|
||||
"hogql_value": "`$virt_revenue`",
|
||||
"id": null,
|
||||
"name": "$virt_revenue",
|
||||
"schema_valid": true,
|
||||
"table": null,
|
||||
"type": "field_traverser"
|
||||
},
|
||||
"$virt_revenue_last_30_days": {
|
||||
"chain": [
|
||||
"revenue_analytics",
|
||||
"revenue_last_30_days"
|
||||
],
|
||||
"fields": null,
|
||||
"hogql_value": "`$virt_revenue_last_30_days`",
|
||||
"id": null,
|
||||
"name": "$virt_revenue_last_30_days",
|
||||
"schema_valid": true,
|
||||
"table": null,
|
||||
"type": "field_traverser"
|
||||
}
|
||||
},
|
||||
"id": "groups",
|
||||
@@ -2577,7 +2623,8 @@
|
||||
"key",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"properties"
|
||||
"properties",
|
||||
"revenue_analytics"
|
||||
],
|
||||
"hogql_value": "group_0",
|
||||
"id": "group_0",
|
||||
@@ -2604,7 +2651,8 @@
|
||||
"key",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"properties"
|
||||
"properties",
|
||||
"revenue_analytics"
|
||||
],
|
||||
"hogql_value": "group_1",
|
||||
"id": "group_1",
|
||||
@@ -2631,7 +2679,8 @@
|
||||
"key",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"properties"
|
||||
"properties",
|
||||
"revenue_analytics"
|
||||
],
|
||||
"hogql_value": "group_2",
|
||||
"id": "group_2",
|
||||
@@ -2658,7 +2707,8 @@
|
||||
"key",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"properties"
|
||||
"properties",
|
||||
"revenue_analytics"
|
||||
],
|
||||
"hogql_value": "group_3",
|
||||
"id": "group_3",
|
||||
@@ -2685,7 +2735,8 @@
|
||||
"key",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"properties"
|
||||
"properties",
|
||||
"revenue_analytics"
|
||||
],
|
||||
"hogql_value": "group_4",
|
||||
"id": "group_4",
|
||||
@@ -2885,6 +2936,47 @@
|
||||
"schema_valid": true,
|
||||
"table": null,
|
||||
"type": "json"
|
||||
},
|
||||
"revenue_analytics": {
|
||||
"chain": null,
|
||||
"fields": [
|
||||
"team_id",
|
||||
"group_key",
|
||||
"revenue",
|
||||
"revenue_last_30_days"
|
||||
],
|
||||
"hogql_value": "revenue_analytics",
|
||||
"id": "revenue_analytics",
|
||||
"name": "revenue_analytics",
|
||||
"schema_valid": true,
|
||||
"table": "groups_revenue_analytics",
|
||||
"type": "lazy_table"
|
||||
},
|
||||
"$virt_revenue": {
|
||||
"chain": [
|
||||
"revenue_analytics",
|
||||
"revenue"
|
||||
],
|
||||
"fields": null,
|
||||
"hogql_value": "`$virt_revenue`",
|
||||
"id": null,
|
||||
"name": "$virt_revenue",
|
||||
"schema_valid": true,
|
||||
"table": null,
|
||||
"type": "field_traverser"
|
||||
},
|
||||
"$virt_revenue_last_30_days": {
|
||||
"chain": [
|
||||
"revenue_analytics",
|
||||
"revenue_last_30_days"
|
||||
],
|
||||
"fields": null,
|
||||
"hogql_value": "`$virt_revenue_last_30_days`",
|
||||
"id": null,
|
||||
"name": "$virt_revenue_last_30_days",
|
||||
"schema_valid": true,
|
||||
"table": null,
|
||||
"type": "field_traverser"
|
||||
}
|
||||
},
|
||||
"id": "groups",
|
||||
|
||||
@@ -38,8 +38,11 @@ class TestProperty(BaseTest):
|
||||
scope: Optional[
|
||||
Literal["event", "person", "group", "session", "replay", "replay_entity", "revenue_analytics"]
|
||||
] = None,
|
||||
strict: bool = True,
|
||||
):
|
||||
return clear_locations(property_to_expr(property, team=team or self.team, scope=scope or "event"))
|
||||
return clear_locations(
|
||||
property_to_expr(property, team=team or self.team, scope=scope or "event", strict=strict)
|
||||
)
|
||||
|
||||
def _selector_to_expr(self, selector: str):
|
||||
return clear_locations(selector_to_expr(selector))
|
||||
@@ -85,7 +88,10 @@ class TestProperty(BaseTest):
|
||||
self._parse_expr("group_0.properties.a in ('b', 'c')"),
|
||||
)
|
||||
|
||||
self.assertEqual(self._property_to_expr({"type": "group", "key": "a", "value": "b"}), self._parse_expr("1"))
|
||||
# Missing group_type_index
|
||||
self.assertEqual(
|
||||
self._property_to_expr({"type": "group", "key": "a", "value": "b"}, strict=False), self._parse_expr("1")
|
||||
)
|
||||
|
||||
def test_property_to_expr_group_scope(self):
|
||||
self.assertEqual(
|
||||
@@ -185,11 +191,13 @@ class TestProperty(BaseTest):
|
||||
)
|
||||
self.assertEqual(
|
||||
self._parse_expr("1"),
|
||||
self._property_to_expr({"type": "event", "key": "a", "operator": "icontains"}), # value missing
|
||||
self._property_to_expr(
|
||||
{"type": "event", "key": "a", "operator": "icontains"}, strict=False
|
||||
), # value missing
|
||||
)
|
||||
self.assertEqual(
|
||||
self._parse_expr("1"),
|
||||
self._property_to_expr({}), # incomplete event
|
||||
self._property_to_expr({}, strict=False), # incomplete event
|
||||
)
|
||||
self.assertEqual(
|
||||
self._parse_expr("1"),
|
||||
@@ -874,6 +882,18 @@ class TestProperty(BaseTest):
|
||||
{"type": "person", "key": "$virt_revenue_last_30_days", "value": 100, "operator": "exact"}, scope="person"
|
||||
) == self._parse_expr("$virt_revenue_last_30_days = 100")
|
||||
|
||||
def test_virtual_group_properties_on_group_scope(self):
|
||||
assert self._property_to_expr(
|
||||
{
|
||||
"type": "group",
|
||||
"key": "$virt_revenue_last_30_days",
|
||||
"value": 100,
|
||||
"operator": "exact",
|
||||
"group_type_index": 0,
|
||||
},
|
||||
scope="group",
|
||||
) == self._parse_expr("$virt_revenue_last_30_days = 100")
|
||||
|
||||
def test_virtual_person_properties_on_event_scope(self):
|
||||
assert self._property_to_expr(
|
||||
{"type": "person", "key": "$virt_initial_channel_type", "value": "Organic Search"}, scope="event"
|
||||
@@ -882,6 +902,12 @@ class TestProperty(BaseTest):
|
||||
{"type": "person", "key": "$virt_revenue", "value": 100, "operator": "exact"}, scope="event"
|
||||
) == self._parse_expr("person.$virt_revenue = 100")
|
||||
|
||||
def test_virtual_group_properties_on_event_scope(self):
|
||||
assert self._property_to_expr(
|
||||
{"type": "group", "key": "$virt_revenue", "value": 100, "operator": "exact", "group_type_index": 0},
|
||||
scope="event",
|
||||
) == self._parse_expr("group_0.$virt_revenue = 100")
|
||||
|
||||
def test_map_virtual_properties(self):
|
||||
assert map_virtual_properties(
|
||||
ast.Field(chain=["person", "properties", "$virt_initial_channel_type"])
|
||||
|
||||
@@ -234,7 +234,11 @@ class RetentionQueryRunner(AnalyticsQueryRunner[RetentionQueryResponse]):
|
||||
else:
|
||||
properties_chain = ["person", "properties", property_name]
|
||||
elif breakdown_type == "group":
|
||||
properties_chain = [f"groups_{group_type_index}", "properties", property_name]
|
||||
if property_name.startswith("$virt_"):
|
||||
# Virtual properties exist as expression fields on the groups table
|
||||
properties_chain = [f"groups_{group_type_index}", property_name]
|
||||
else:
|
||||
properties_chain = [f"groups_{group_type_index}", "properties", property_name]
|
||||
else:
|
||||
# Default to event properties
|
||||
properties_chain = ["events", "properties", property_name]
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -35,7 +35,11 @@ def get_properties_chain(
|
||||
|
||||
if breakdown_type == "group" and group_type_index is not None:
|
||||
group_type_index_int = int(group_type_index)
|
||||
return [f"group_{group_type_index_int}", "properties", breakdown_field]
|
||||
if breakdown_field.startswith("$virt_"):
|
||||
# Virtual properties exist as expression fields on the groups table
|
||||
return [f"group_{group_type_index_int}", breakdown_field]
|
||||
else:
|
||||
return [f"group_{group_type_index_int}", "properties", breakdown_field]
|
||||
elif breakdown_type == "group" and group_type_index is None:
|
||||
raise Exception("group_type_index missing from params")
|
||||
|
||||
|
||||
@@ -541,6 +541,19 @@ class PropertyDefinitionViewSet(
|
||||
if val.get("virtual", False)
|
||||
]
|
||||
|
||||
_BUILTIN_VIRTUAL_GROUP_PROPERTIES = [
|
||||
{
|
||||
"id": "$builtin_" + key,
|
||||
"name": key,
|
||||
"is_numerical": val["type"] == "Numeric",
|
||||
"property_type": val["type"],
|
||||
"tags": val.get("tags", []),
|
||||
"virtual": True,
|
||||
}
|
||||
for (key, val) in CORE_FILTER_DEFINITIONS_BY_GROUP["groups"].items()
|
||||
if val.get("virtual", False)
|
||||
]
|
||||
|
||||
def dangerously_get_queryset(self):
|
||||
queryset: Union[QuerySet[PropertyDefinition], Manager[PropertyDefinition]] = PropertyDefinition.objects.all()
|
||||
property_definition_fields = ", ".join(
|
||||
@@ -693,25 +706,31 @@ class PropertyDefinitionViewSet(
|
||||
def list(self, request, *args, **kwargs):
|
||||
response = super().list(request, *args, **kwargs)
|
||||
|
||||
# Inject virtual person properties to the end of the results
|
||||
if request.query_params.get("type", "event") == "person":
|
||||
event_type = request.query_params.get("type", "event")
|
||||
|
||||
# Inject virtual person/group properties to the end of the results
|
||||
if event_type in ["person", "group"]:
|
||||
paginator = self.paginator
|
||||
assert isinstance(paginator, NotCountingLimitOffsetPaginator)
|
||||
|
||||
query = PropertyDefinitionQuerySerializer(data=request.query_params)
|
||||
query.is_valid(raise_exception=True)
|
||||
|
||||
matching_virtual_props = [
|
||||
p for p in self._BUILTIN_VIRTUAL_PERSON_PROPERTIES if self._filter_virtual_property(p, query)
|
||||
]
|
||||
virtual_properties = (
|
||||
self._BUILTIN_VIRTUAL_PERSON_PROPERTIES
|
||||
if event_type == "person"
|
||||
else self._BUILTIN_VIRTUAL_GROUP_PROPERTIES
|
||||
)
|
||||
|
||||
matching_virtual_props = [p for p in virtual_properties if self._filter_virtual_property(p, query)]
|
||||
|
||||
db_count = response.data["count"]
|
||||
page_end_index = (paginator.offset or 0) + len(response.data["results"])
|
||||
is_last_page = page_end_index >= db_count
|
||||
|
||||
# Add virtual properties to the end of the results
|
||||
# Technically, this means that the last page can be longer than the others, but as the number of virtual properties is small, this is acceptable
|
||||
if is_last_page:
|
||||
# Add virtual properties to the end of the results
|
||||
# Technically, this means that the last page can be longer than the others, but as the number of virtual properties is small, this is acceptable
|
||||
response.data["results"].extend(matching_virtual_props)
|
||||
|
||||
response.data["count"] = db_count + len(matching_virtual_props)
|
||||
@@ -722,8 +741,8 @@ class PropertyDefinitionViewSet(
|
||||
# Reimplement filtering logic in python for virtual properties
|
||||
v = q.validated_data
|
||||
|
||||
# Virtual properties only exist for person type
|
||||
if v.get("type") != "person":
|
||||
# Virtual properties only exist for person and groups
|
||||
if v.get("type") not in ["person", "group"]:
|
||||
return False
|
||||
|
||||
# explicit name filter (?properties=a,b,c)
|
||||
|
||||
@@ -2128,6 +2128,18 @@ CORE_FILTER_DEFINITIONS_BY_GROUP: dict[str, dict[str, CoreFilterDefinition]] = {
|
||||
"label": "Group key",
|
||||
"description": "Specified group key",
|
||||
},
|
||||
"$virt_revenue": {
|
||||
"description": "The total revenue for this group. This will always be the current total revenue even when referring to a group via events.",
|
||||
"label": "Total revenue",
|
||||
"type": "Numeric",
|
||||
"virtual": True,
|
||||
},
|
||||
"$virt_revenue_last_30_days": {
|
||||
"description": "The total revenue for this group in the last 30 days.",
|
||||
"label": "Total revenue in the last 30 days",
|
||||
"type": "Numeric",
|
||||
"virtual": True,
|
||||
},
|
||||
},
|
||||
"replay": {
|
||||
"snapshot_source": {
|
||||
|
||||
@@ -352,6 +352,11 @@ class RevenueAnalyticsMRRQueryRunner(RevenueAnalyticsQueryRunner[RevenueAnalytic
|
||||
ast.Alias(alias="is_recurring", expr=ast.Constant(value=True)),
|
||||
ast.Alias(alias="product_id", expr=ast.Field(chain=["subscription", "product_id"])),
|
||||
ast.Alias(alias="customer_id", expr=ast.Field(chain=["subscription", "customer_id"])),
|
||||
ast.Alias(alias="group_0_key", expr=ast.Constant(value=None)),
|
||||
ast.Alias(alias="group_1_key", expr=ast.Constant(value=None)),
|
||||
ast.Alias(alias="group_2_key", expr=ast.Constant(value=None)),
|
||||
ast.Alias(alias="group_3_key", expr=ast.Constant(value=None)),
|
||||
ast.Alias(alias="group_4_key", expr=ast.Constant(value=None)),
|
||||
ast.Alias(alias="invoice_id", expr=ast.Constant(value=None)),
|
||||
ast.Alias(alias="subscription_id", expr=ast.Field(chain=["subscription", "id"])),
|
||||
ast.Alias(alias="session_id", expr=ast.Constant(value=None)),
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -35,6 +40,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -90,6 +100,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -112,6 +127,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -143,6 +163,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -165,6 +190,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -205,6 +235,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -349,6 +384,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -371,6 +411,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -402,6 +447,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -424,6 +474,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -464,6 +519,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -608,6 +668,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -630,6 +695,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -661,6 +731,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -683,6 +758,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -723,6 +803,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -771,6 +856,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -793,6 +883,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -824,6 +919,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -846,6 +946,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -886,6 +991,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -934,6 +1044,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -956,6 +1071,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -987,6 +1107,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -1009,6 +1134,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1049,6 +1179,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1214,6 +1349,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -1236,6 +1376,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1267,6 +1412,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -1289,6 +1439,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1329,6 +1484,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1398,6 +1558,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -1420,6 +1585,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1451,6 +1621,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -1473,6 +1648,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1513,6 +1693,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1561,6 +1746,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -1583,6 +1773,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1614,6 +1809,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -1636,6 +1836,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1676,6 +1881,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1820,6 +2030,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -1842,6 +2057,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1874,6 +2094,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -1896,6 +2121,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1936,6 +2166,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -2080,6 +2315,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -2102,6 +2342,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -2133,6 +2378,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -2155,6 +2405,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -2195,6 +2450,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -2360,6 +2620,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -2382,6 +2647,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -2413,6 +2683,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -2435,6 +2710,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -2475,6 +2755,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -2544,6 +2829,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -2566,6 +2856,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -2597,6 +2892,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -2619,6 +2919,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -2659,6 +2964,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
|
||||
@@ -27,6 +27,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -49,6 +54,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -116,6 +126,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -138,6 +153,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -169,6 +189,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -191,6 +216,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -328,6 +358,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -350,6 +385,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -381,6 +421,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -403,6 +448,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -479,6 +529,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -501,6 +556,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -532,6 +592,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -554,6 +619,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -630,6 +700,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -652,6 +727,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -683,6 +763,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -705,6 +790,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -781,6 +871,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -803,6 +898,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -834,6 +934,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -856,6 +961,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -993,6 +1103,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -1015,6 +1130,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1047,6 +1167,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -1069,6 +1194,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1206,6 +1336,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -1228,6 +1363,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1259,6 +1399,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -1281,6 +1426,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
|
||||
@@ -80,6 +80,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -102,6 +107,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -248,6 +258,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -270,6 +285,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -301,6 +321,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -323,6 +348,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -363,6 +393,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -599,6 +634,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -621,6 +661,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -652,6 +697,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -674,6 +724,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -714,6 +769,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -950,6 +1010,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -972,6 +1037,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1003,6 +1073,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -1025,6 +1100,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1065,6 +1145,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1204,6 +1289,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -1226,6 +1316,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1257,6 +1352,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -1279,6 +1379,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1319,6 +1424,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1458,6 +1568,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -1480,6 +1595,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1511,6 +1631,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -1533,6 +1658,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1573,6 +1703,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1733,6 +1868,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -1755,6 +1895,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1786,6 +1931,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -1808,6 +1958,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1848,6 +2003,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1987,6 +2147,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -2009,6 +2174,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -2040,6 +2210,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -2062,6 +2237,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -2102,6 +2282,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -2338,6 +2523,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -2360,6 +2550,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -2391,6 +2586,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -2413,6 +2613,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -2453,6 +2658,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -2689,6 +2899,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -2711,6 +2926,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -2742,6 +2962,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -2764,6 +2989,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -2804,6 +3034,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -2966,6 +3201,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -2988,6 +3228,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -3019,6 +3264,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -3041,6 +3291,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -3081,6 +3336,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -3242,6 +3502,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -3264,6 +3529,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -3295,6 +3565,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -3317,6 +3592,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -3357,6 +3637,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
|
||||
@@ -66,6 +66,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -88,6 +93,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -119,6 +129,11 @@
|
||||
1 AS is_recurring,
|
||||
subscription.product_id AS product_id,
|
||||
subscription.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
subscription.id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -272,6 +287,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -294,6 +314,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -325,6 +350,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -347,6 +377,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -387,6 +422,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -411,6 +451,11 @@
|
||||
1 AS is_recurring,
|
||||
subscription.product_id AS product_id,
|
||||
subscription.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
subscription.id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -680,6 +725,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -702,6 +752,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -733,6 +788,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -755,6 +815,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -795,6 +860,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -819,6 +889,11 @@
|
||||
1 AS is_recurring,
|
||||
subscription.product_id AS product_id,
|
||||
subscription.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
subscription.id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1088,6 +1163,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -1110,6 +1190,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1141,6 +1226,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -1163,6 +1253,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1203,6 +1298,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1227,6 +1327,11 @@
|
||||
1 AS is_recurring,
|
||||
subscription.product_id AS product_id,
|
||||
subscription.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
subscription.id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1400,6 +1505,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -1422,6 +1532,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1453,6 +1568,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -1475,6 +1595,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1515,6 +1640,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1539,6 +1669,11 @@
|
||||
1 AS is_recurring,
|
||||
subscription.product_id AS product_id,
|
||||
subscription.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
subscription.id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1712,6 +1847,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -1734,6 +1874,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1765,6 +1910,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -1787,6 +1937,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1827,6 +1982,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1851,6 +2011,11 @@
|
||||
1 AS is_recurring,
|
||||
subscription.product_id AS product_id,
|
||||
subscription.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
subscription.id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -2022,6 +2187,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -2044,6 +2214,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -2075,6 +2250,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -2097,6 +2277,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -2137,6 +2322,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -2161,6 +2351,11 @@
|
||||
1 AS is_recurring,
|
||||
subscription.product_id AS product_id,
|
||||
subscription.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
subscription.id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -2451,6 +2646,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -2473,6 +2673,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -2504,6 +2709,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -2526,6 +2736,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -2566,6 +2781,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -2590,6 +2810,11 @@
|
||||
1 AS is_recurring,
|
||||
subscription.product_id AS product_id,
|
||||
subscription.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
subscription.id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -2784,6 +3009,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -2806,6 +3036,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -2837,6 +3072,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -2859,6 +3099,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -2899,6 +3144,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -2923,6 +3173,11 @@
|
||||
1 AS is_recurring,
|
||||
subscription.product_id AS product_id,
|
||||
subscription.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
subscription.id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -3096,6 +3351,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -3118,6 +3378,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -3149,6 +3414,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -3171,6 +3441,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -3211,6 +3486,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -3235,6 +3515,11 @@
|
||||
1 AS is_recurring,
|
||||
subscription.product_id AS product_id,
|
||||
subscription.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
subscription.id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -3504,6 +3789,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -3526,6 +3816,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -3558,6 +3853,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -3580,6 +3880,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -3620,6 +3925,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -3644,6 +3954,11 @@
|
||||
1 AS is_recurring,
|
||||
subscription.product_id AS product_id,
|
||||
subscription.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
subscription.id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -3913,6 +4228,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -3935,6 +4255,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -3966,6 +4291,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -3988,6 +4318,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -4028,6 +4363,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -4052,6 +4392,11 @@
|
||||
1 AS is_recurring,
|
||||
subscription.product_id AS product_id,
|
||||
subscription.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
subscription.id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -4342,6 +4687,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -4364,6 +4714,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -4395,6 +4750,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -4417,6 +4777,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -4457,6 +4822,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -4481,6 +4851,11 @@
|
||||
1 AS is_recurring,
|
||||
subscription.product_id AS product_id,
|
||||
subscription.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
subscription.id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -4675,6 +5050,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -4697,6 +5077,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -4728,6 +5113,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -4750,6 +5140,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -4790,6 +5185,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -4814,6 +5214,11 @@
|
||||
1 AS is_recurring,
|
||||
subscription.product_id AS product_id,
|
||||
subscription.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
subscription.id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -35,6 +40,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -66,6 +76,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -88,6 +103,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -128,6 +148,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -171,6 +196,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -193,6 +223,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -224,6 +259,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -246,6 +286,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -286,6 +331,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -329,6 +379,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -351,6 +406,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -401,6 +461,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -423,6 +488,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -454,6 +524,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -476,6 +551,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -516,6 +596,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -559,6 +644,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -581,6 +671,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -612,6 +707,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -634,6 +734,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -674,6 +779,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -717,6 +827,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -739,6 +854,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -770,6 +890,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -792,6 +917,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -832,6 +962,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -936,6 +1071,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -958,6 +1098,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -990,6 +1135,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -1012,6 +1162,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1052,6 +1207,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1156,6 +1316,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -1178,6 +1343,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1209,6 +1379,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -1231,6 +1406,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1271,6 +1451,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1335,6 +1520,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -1357,6 +1547,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1388,6 +1583,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -1410,6 +1610,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1450,6 +1655,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -41,6 +46,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -191,6 +201,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -213,6 +228,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -244,6 +264,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -266,6 +291,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -306,6 +336,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -458,6 +493,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -480,6 +520,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -511,6 +556,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -533,6 +583,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -573,6 +628,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -725,6 +785,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -747,6 +812,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -778,6 +848,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -800,6 +875,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -840,6 +920,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -992,6 +1077,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -1014,6 +1104,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1045,6 +1140,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -1067,6 +1167,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1107,6 +1212,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1261,6 +1371,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -1283,6 +1398,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1314,6 +1434,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -1336,6 +1461,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1376,6 +1506,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1528,6 +1663,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -1550,6 +1690,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1582,6 +1727,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -1604,6 +1754,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1644,6 +1799,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1796,6 +1956,11 @@
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.is_recurring AS is_recurring,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.product_id AS product_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.customer_id AS customer_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_0_key AS group_0_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_1_key AS group_1_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_2_key AS group_2_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_3_key AS group_3_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.group_4_key AS group_4_key,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.invoice_id AS invoice_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.subscription_id AS subscription_id,
|
||||
`revenue_analytics.events.purchase.revenue_item_events_revenue_view`.session_id AS session_id,
|
||||
@@ -1818,6 +1983,11 @@
|
||||
isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '')) AS is_recurring,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'product'), ''), 'null'), '^"|"$', '') AS product_id,
|
||||
toString(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS customer_id,
|
||||
events.`$group_0` AS group_0_key,
|
||||
events.`$group_1` AS group_1_key,
|
||||
events.`$group_2` AS group_2_key,
|
||||
events.`$group_3` AS group_3_key,
|
||||
events.`$group_4` AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'subscription'), ''), 'null'), '^"|"$', '') AS subscription_id,
|
||||
toString(events.`$session_id`) AS session_id,
|
||||
@@ -1849,6 +2019,11 @@
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.is_recurring AS is_recurring,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.product_id AS product_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.customer_id AS customer_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_0_key AS group_0_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_1_key AS group_1_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_2_key AS group_2_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_3_key AS group_3_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.group_4_key AS group_4_key,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.invoice_id AS invoice_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.subscription_id AS subscription_id,
|
||||
`stripe.posthog_test.revenue_item_revenue_view`.session_id AS session_id,
|
||||
@@ -1871,6 +2046,11 @@
|
||||
ifNull(notEmpty(invoice.subscription_id), 0) AS is_recurring,
|
||||
invoice.product_id AS product_id,
|
||||
invoice.customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
invoice.subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -1911,6 +2091,11 @@
|
||||
0 AS is_recurring,
|
||||
NULL AS product_id,
|
||||
posthog_test_stripe_charge.customer AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
posthog_test_stripe_charge.invoice AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
|
||||
@@ -13,6 +13,11 @@ FIELDS: FieldsDict = {
|
||||
"is_recurring": BooleanDatabaseField(name="is_recurring"),
|
||||
"product_id": StringDatabaseField(name="product_id"),
|
||||
"customer_id": StringDatabaseField(name="customer_id"),
|
||||
"group_0_key": StringDatabaseField(name="group_0_key"),
|
||||
"group_1_key": StringDatabaseField(name="group_1_key"),
|
||||
"group_2_key": StringDatabaseField(name="group_2_key"),
|
||||
"group_3_key": StringDatabaseField(name="group_3_key"),
|
||||
"group_4_key": StringDatabaseField(name="group_4_key"),
|
||||
"invoice_id": StringDatabaseField(name="invoice_id"),
|
||||
"subscription_id": StringDatabaseField(name="subscription_id"),
|
||||
"session_id": StringDatabaseField(name="session_id"),
|
||||
|
||||
@@ -65,6 +65,11 @@ def build(handle: SourceHandle) -> Iterable[BuiltQuery]:
|
||||
else ast.Constant(value=None),
|
||||
),
|
||||
ast.Alias(alias="customer_id", expr=ast.Call(name="toString", args=[ast.Field(chain=["person_id"])])),
|
||||
ast.Alias(alias="group_0_key", expr=ast.Field(chain=["$group_0"])),
|
||||
ast.Alias(alias="group_1_key", expr=ast.Field(chain=["$group_1"])),
|
||||
ast.Alias(alias="group_2_key", expr=ast.Field(chain=["$group_2"])),
|
||||
ast.Alias(alias="group_3_key", expr=ast.Field(chain=["$group_3"])),
|
||||
ast.Alias(alias="group_4_key", expr=ast.Field(chain=["$group_4"])),
|
||||
ast.Alias(alias="invoice_id", expr=ast.Constant(value=None)),
|
||||
ast.Alias(
|
||||
alias="subscription_id",
|
||||
|
||||
@@ -187,6 +187,11 @@ def build(handle: SourceHandle) -> Iterable[BuiltQuery]:
|
||||
),
|
||||
ast.Alias(alias="product_id", expr=ast.Field(chain=["product_id"])),
|
||||
ast.Alias(alias="customer_id", expr=ast.Field(chain=["customer_id"])),
|
||||
ast.Alias(alias="group_0_key", expr=ast.Constant(value=None)),
|
||||
ast.Alias(alias="group_1_key", expr=ast.Constant(value=None)),
|
||||
ast.Alias(alias="group_2_key", expr=ast.Constant(value=None)),
|
||||
ast.Alias(alias="group_3_key", expr=ast.Constant(value=None)),
|
||||
ast.Alias(alias="group_4_key", expr=ast.Constant(value=None)),
|
||||
ast.Alias(alias="invoice_id", expr=ast.Field(chain=["invoice", "id"])),
|
||||
ast.Alias(alias="subscription_id", expr=ast.Field(chain=["subscription_id"])),
|
||||
ast.Alias(alias="session_id", expr=ast.Constant(value=None)),
|
||||
@@ -358,6 +363,11 @@ def build(handle: SourceHandle) -> Iterable[BuiltQuery]:
|
||||
ast.Alias(alias="is_recurring", expr=ast.Constant(value=False)),
|
||||
ast.Alias(alias="product_id", expr=ast.Constant(value=None)),
|
||||
ast.Alias(alias="customer_id", expr=ast.Field(chain=["customer_id"])),
|
||||
ast.Alias(alias="group_0_key", expr=ast.Constant(value=None)),
|
||||
ast.Alias(alias="group_1_key", expr=ast.Constant(value=None)),
|
||||
ast.Alias(alias="group_2_key", expr=ast.Constant(value=None)),
|
||||
ast.Alias(alias="group_3_key", expr=ast.Constant(value=None)),
|
||||
ast.Alias(alias="group_4_key", expr=ast.Constant(value=None)),
|
||||
ast.Alias(alias="invoice_id", expr=ast.Field(chain=["invoice_id"])), # Will be empty
|
||||
ast.Alias(alias="subscription_id", expr=ast.Constant(value=None)),
|
||||
ast.Alias(alias="session_id", expr=ast.Constant(value=None)),
|
||||
|
||||
@@ -9,6 +9,11 @@
|
||||
false AS is_recurring,
|
||||
NULL AS product_id,
|
||||
toString(person_id) AS customer_id,
|
||||
$group_0 AS group_0_key,
|
||||
$group_1 AS group_1_key,
|
||||
$group_2 AS group_2_key,
|
||||
$group_3 AS group_3_key,
|
||||
$group_4 AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
toString($session_id) AS session_id,
|
||||
@@ -38,6 +43,11 @@
|
||||
isNotNull(properties.subscription_id) AS is_recurring,
|
||||
properties.product_id AS product_id,
|
||||
toString(person_id) AS customer_id,
|
||||
$group_0 AS group_0_key,
|
||||
$group_1 AS group_1_key,
|
||||
$group_2 AS group_2_key,
|
||||
$group_3 AS group_3_key,
|
||||
$group_4 AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
properties.subscription_id AS subscription_id,
|
||||
toString($session_id) AS session_id,
|
||||
@@ -66,6 +76,11 @@
|
||||
false AS is_recurring,
|
||||
NULL AS product_id,
|
||||
toString(person_id) AS customer_id,
|
||||
$group_0 AS group_0_key,
|
||||
$group_1 AS group_1_key,
|
||||
$group_2 AS group_2_key,
|
||||
$group_3 AS group_3_key,
|
||||
$group_4 AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
toString($session_id) AS session_id,
|
||||
@@ -95,6 +110,11 @@
|
||||
isNotNull(properties.subscription_id) AS is_recurring,
|
||||
properties.product_id AS product_id,
|
||||
toString(person_id) AS customer_id,
|
||||
$group_0 AS group_0_key,
|
||||
$group_1 AS group_1_key,
|
||||
$group_2 AS group_2_key,
|
||||
$group_3 AS group_3_key,
|
||||
$group_4 AS group_4_key,
|
||||
NULL AS invoice_id,
|
||||
properties.subscription_id AS subscription_id,
|
||||
toString($session_id) AS session_id,
|
||||
|
||||
@@ -9,6 +9,11 @@
|
||||
ifNull(notEmpty(subscription_id), false) AS is_recurring,
|
||||
product_id AS product_id,
|
||||
customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -50,6 +55,11 @@
|
||||
false AS is_recurring,
|
||||
NULL AS product_id,
|
||||
customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice_id AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -78,6 +88,11 @@
|
||||
ifNull(notEmpty(subscription_id), false) AS is_recurring,
|
||||
product_id AS product_id,
|
||||
customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -137,6 +152,11 @@
|
||||
ifNull(notEmpty(subscription_id), false) AS is_recurring,
|
||||
product_id AS product_id,
|
||||
customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice.id AS invoice_id,
|
||||
subscription_id AS subscription_id,
|
||||
NULL AS session_id,
|
||||
@@ -178,6 +198,11 @@
|
||||
false AS is_recurring,
|
||||
NULL AS product_id,
|
||||
customer_id AS customer_id,
|
||||
NULL AS group_0_key,
|
||||
NULL AS group_1_key,
|
||||
NULL AS group_2_key,
|
||||
NULL AS group_3_key,
|
||||
NULL AS group_4_key,
|
||||
invoice_id AS invoice_id,
|
||||
NULL AS subscription_id,
|
||||
NULL AS session_id,
|
||||
|
||||
@@ -97,7 +97,7 @@ export function ExternalDataSourceConfiguration({
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'joins',
|
||||
key: 'persons_join',
|
||||
title: (
|
||||
<span>
|
||||
Persons Join
|
||||
@@ -153,6 +153,63 @@ export function ExternalDataSourceConfiguration({
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'groups_join',
|
||||
title: (
|
||||
<span>
|
||||
Groups Join
|
||||
<Tooltip title="How do you want to join groups to this source in Revenue Analytics?">
|
||||
<IconInfo className="ml-1" />
|
||||
</Tooltip>
|
||||
</span>
|
||||
),
|
||||
render: (_, item: ExternalDataSource) => {
|
||||
const itemPrefix = item.prefix
|
||||
? `${item.source_type.toLowerCase()}.${item.prefix.replace(/_+$/, '')}`
|
||||
: item.source_type.toLowerCase()
|
||||
const joinName = `${itemPrefix}.customer_revenue_view`
|
||||
const join = joins.find(
|
||||
(join) => join.source_table_name === joinName && join.joining_table_name === 'groups'
|
||||
)
|
||||
|
||||
return (
|
||||
<span className="flex flex-row items-center gap-2 my-2">
|
||||
<span>
|
||||
Joined to <code>groups</code> via:
|
||||
</span>
|
||||
|
||||
{join ? (
|
||||
<LemonButton
|
||||
type="secondary"
|
||||
size="small"
|
||||
onClick={() => toggleEditJoinModal(join)}
|
||||
>
|
||||
{join.source_table_name}.{join.source_table_key}
|
||||
</LemonButton>
|
||||
) : (
|
||||
<LemonButton
|
||||
type="secondary"
|
||||
size="small"
|
||||
icon={<IconPlus />}
|
||||
onClick={() =>
|
||||
// This is all very hardcoded, but it's the exact kind of join we want to add
|
||||
// and that we're expecting in the backend.
|
||||
toggleNewJoinModal({
|
||||
source_table_name: joinName,
|
||||
source_table_key: 'id',
|
||||
joining_table_name: 'groups',
|
||||
joining_table_key: 'group_key',
|
||||
field_name: 'groups',
|
||||
})
|
||||
}
|
||||
>
|
||||
Add join
|
||||
</LemonButton>
|
||||
)}
|
||||
</span>
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'revenue_analytics_enabled',
|
||||
title: 'Enabled?',
|
||||
|
||||
Reference in New Issue
Block a user