Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(dashboards): remove remaining filters from dashboard templates #26836

Merged
merged 12 commits into from
Dec 13, 2024
657 changes: 537 additions & 120 deletions ee/clickhouse/views/test/__snapshots__/test_clickhouse_experiments.ambr

Large diffs are not rendered by default.

58 changes: 32 additions & 26 deletions posthog/api/test/__snapshots__/test_event.ambr
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# serializer version: 1
# name: TestEvents.test_event_property_values
'''
/* celery:posthog.tasks.tasks.sync_insight_caching_state */
SELECT team_id,
date_diff('second', max(timestamp), now()) AS age
/* user_id:0 request:_snapshot_ */
SELECT DISTINCT replaceRegexpAll(JSONExtractRaw(properties, 'random_prop'), '^"|"$', '')
FROM events
WHERE timestamp > date_sub(DAY, 3, now())
AND timestamp < now()
GROUP BY team_id
ORDER BY age;
WHERE team_id = 99999
AND JSONHas(properties, 'random_prop')
AND timestamp >= '2020-01-13 00:00:00'
AND timestamp <= '2020-01-20 23:59:59'
LIMIT 10
'''
# ---
# name: TestEvents.test_event_property_values.1
Expand All @@ -20,6 +20,8 @@
AND JSONHas(properties, 'random_prop')
AND timestamp >= '2020-01-13 00:00:00'
AND timestamp <= '2020-01-20 23:59:59'
AND replaceRegexpAll(JSONExtractRaw(properties, 'random_prop'), '^"|"$', '') ILIKE '%qw%'
order by length(replaceRegexpAll(JSONExtractRaw(properties, 'random_prop'), '^"|"$', ''))
LIMIT 10
'''
# ---
Expand All @@ -32,7 +34,7 @@
AND JSONHas(properties, 'random_prop')
AND timestamp >= '2020-01-13 00:00:00'
AND timestamp <= '2020-01-20 23:59:59'
AND replaceRegexpAll(JSONExtractRaw(properties, 'random_prop'), '^"|"$', '') ILIKE '%qw%'
AND replaceRegexpAll(JSONExtractRaw(properties, 'random_prop'), '^"|"$', '') ILIKE '%QW%'
order by length(replaceRegexpAll(JSONExtractRaw(properties, 'random_prop'), '^"|"$', ''))
LIMIT 10
'''
Expand All @@ -46,7 +48,7 @@
AND JSONHas(properties, 'random_prop')
AND timestamp >= '2020-01-13 00:00:00'
AND timestamp <= '2020-01-20 23:59:59'
AND replaceRegexpAll(JSONExtractRaw(properties, 'random_prop'), '^"|"$', '') ILIKE '%QW%'
AND replaceRegexpAll(JSONExtractRaw(properties, 'random_prop'), '^"|"$', '') ILIKE '%6%'
order by length(replaceRegexpAll(JSONExtractRaw(properties, 'random_prop'), '^"|"$', ''))
LIMIT 10
'''
Expand All @@ -60,6 +62,7 @@
AND JSONHas(properties, 'random_prop')
AND timestamp >= '2020-01-13 00:00:00'
AND timestamp <= '2020-01-20 23:59:59'
AND (event = 'random event')
AND replaceRegexpAll(JSONExtractRaw(properties, 'random_prop'), '^"|"$', '') ILIKE '%6%'
order by length(replaceRegexpAll(JSONExtractRaw(properties, 'random_prop'), '^"|"$', ''))
LIMIT 10
Expand All @@ -74,7 +77,8 @@
AND JSONHas(properties, 'random_prop')
AND timestamp >= '2020-01-13 00:00:00'
AND timestamp <= '2020-01-20 23:59:59'
AND (event = 'random event')
AND (event = 'foo'
OR event = 'random event')
AND replaceRegexpAll(JSONExtractRaw(properties, 'random_prop'), '^"|"$', '') ILIKE '%6%'
order by length(replaceRegexpAll(JSONExtractRaw(properties, 'random_prop'), '^"|"$', ''))
LIMIT 10
Expand All @@ -89,9 +93,8 @@
AND JSONHas(properties, 'random_prop')
AND timestamp >= '2020-01-13 00:00:00'
AND timestamp <= '2020-01-20 23:59:59'
AND (event = 'foo'
OR event = 'random event')
AND replaceRegexpAll(JSONExtractRaw(properties, 'random_prop'), '^"|"$', '') ILIKE '%6%'
AND (event = '404_i_dont_exist')
AND replaceRegexpAll(JSONExtractRaw(properties, 'random_prop'), '^"|"$', '') ILIKE '%qw%'
order by length(replaceRegexpAll(JSONExtractRaw(properties, 'random_prop'), '^"|"$', ''))
LIMIT 10
'''
Expand All @@ -113,14 +116,14 @@
# ---
# name: TestEvents.test_event_property_values_materialized
'''
/* celery:posthog.tasks.tasks.sync_insight_caching_state */
SELECT team_id,
date_diff('second', max(timestamp), now()) AS age
/* user_id:0 request:_snapshot_ */
SELECT DISTINCT "mat_random_prop"
FROM events
WHERE timestamp > date_sub(DAY, 3, now())
AND timestamp < now()
GROUP BY team_id
ORDER BY age;
WHERE team_id = 99999
AND notEmpty("mat_random_prop")
AND timestamp >= '2020-01-13 00:00:00'
AND timestamp <= '2020-01-20 23:59:59'
LIMIT 10
'''
# ---
# name: TestEvents.test_event_property_values_materialized.1
Expand All @@ -132,6 +135,8 @@
AND notEmpty("mat_random_prop")
AND timestamp >= '2020-01-13 00:00:00'
AND timestamp <= '2020-01-20 23:59:59'
AND "mat_random_prop" ILIKE '%qw%'
order by length("mat_random_prop")
LIMIT 10
'''
# ---
Expand All @@ -144,7 +149,7 @@
AND notEmpty("mat_random_prop")
AND timestamp >= '2020-01-13 00:00:00'
AND timestamp <= '2020-01-20 23:59:59'
AND "mat_random_prop" ILIKE '%qw%'
AND "mat_random_prop" ILIKE '%QW%'
order by length("mat_random_prop")
LIMIT 10
'''
Expand All @@ -158,7 +163,7 @@
AND notEmpty("mat_random_prop")
AND timestamp >= '2020-01-13 00:00:00'
AND timestamp <= '2020-01-20 23:59:59'
AND "mat_random_prop" ILIKE '%QW%'
AND "mat_random_prop" ILIKE '%6%'
order by length("mat_random_prop")
LIMIT 10
'''
Expand All @@ -172,6 +177,7 @@
AND notEmpty("mat_random_prop")
AND timestamp >= '2020-01-13 00:00:00'
AND timestamp <= '2020-01-20 23:59:59'
AND (event = 'random event')
AND "mat_random_prop" ILIKE '%6%'
order by length("mat_random_prop")
LIMIT 10
Expand All @@ -186,7 +192,8 @@
AND notEmpty("mat_random_prop")
AND timestamp >= '2020-01-13 00:00:00'
AND timestamp <= '2020-01-20 23:59:59'
AND (event = 'random event')
AND (event = 'foo'
OR event = 'random event')
AND "mat_random_prop" ILIKE '%6%'
order by length("mat_random_prop")
LIMIT 10
Expand All @@ -201,9 +208,8 @@
AND notEmpty("mat_random_prop")
AND timestamp >= '2020-01-13 00:00:00'
AND timestamp <= '2020-01-20 23:59:59'
AND (event = 'foo'
OR event = 'random event')
AND "mat_random_prop" ILIKE '%6%'
AND (event = '404_i_dont_exist')
AND "mat_random_prop" ILIKE '%qw%'
order by length("mat_random_prop")
LIMIT 10
'''
Expand Down
2 changes: 1 addition & 1 deletion posthog/api/test/dashboards/test_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ def test_create_from_template_json_can_provide_query_tile(self) -> None:
"effective_privilege_level": 37,
"effective_restriction_level": 21,
"favorited": False,
"filters": {"filter_test_accounts": True},
"filters": {},
"filters_hash": ANY,
"hasMore": None,
"id": ANY,
Expand Down
Loading
Loading