* paginate session recording events api
* code quality
* don't rerender replayer every time events get loaded
* refactor session recordings, make it backwards compatible, add bunch of tests
* move limit and offset to after decompress
* change limit
* add caching of recording
* add duration
* fix a few tests
* fix api tests
* add partial chunk test
* fix default limit test
* code quality
* typing
* fix backend tests
* mypy fixes and signature
* remove circular dependency
* mypy and sessionsplaylogic tests
* fix migration
* make single migration
* revert mypy typing
* remove require react resolve
* fix loading state to persist across multi chunks and add test'
* cleanup
* duration to ms
* fix duration tests
* remove require react resolve
* fix test
* bump rrweb player
* change cache behavior plus more
* fix frontend tests and make duration calculation more robust
* fix timestamp in ms bug in tests
* fix duration 0 test
* fix compatibility with rrweb-player
* update lockfile
* yarn unlink
* resolve kea-test-utils changes
* another one
* remove caching for now (leave as todo) and change limit to 100
* Refactor column_optimizer to work differently
* WIP: Use counter over set
* Handle person filters in person query
* Remove a dead argument
* Use enum over parameter for determining behavior
* Allow excluding person properties mode when handled in person query
* Fix _get_person_query type
* Use correct table for funnel_event_query
* Remove unneeded override
* Add extra typing
* Filter by entity.properties in person query for trends
* Handle error 184 due to naming clash
* Better default for prop_filter_json_extract
* Update column_optimizer tests for Counter
* Handle person_props as extra_fields
* Handle breakdowns and person property filter pushdown
* Transform values correctly
* Simplify get_entity_filtering_params
* Fix funnel correlations
* Solve caching issues in trend people queries
* Remove @skip test
* Add syrupy tests for parse_prop_clauses
Can update these via --snapshot-update
* Add snapshot tests for person queries
* Add a few notes
* Update test to avoid collision
* Kill dead code
* Handle PR comments
* Update ee/clickhouse/queries/person_query.py
Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
* Add `slug` fields to `Organization` and `Team`
* Expose slugs to user
* Add slug autogeneration for new orgs/projects
* Improve slug UX
* Remove slug from settings
* Update org/team instance creation plus add tests
* Only require project slug to be unique for org, not globally
* Fix `get_prep_value`
* Test organization slugification
* Deslugify `Team`
* Clean up changes
* Update test_user.py
* Apply suggestions from code review
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
* Random 4 letter suffixes for the win
* Fix import
* Ignore `test_migrations_are_null`
* Fix `RunSQL` query being empty
* Fix `generate_random_short_suffix` testing
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
This seems to be semi-consistently failing locally for me and
inconsistently on CI. The cause is unknown - debugging locally, this
seems more of a query correctness issue than a test data incomplete
issue.
* fix bug where session recording is split by new distinct_id
* fix query bug to allow distinct_id clause
* Basic query filtering by events on clickhouse
* add duration filtering
* Add multiple action/event filters
* Move to using person_id + optimize query
* add postgres support and querying on person_id
* move back to distinct_ids
* remove lots of duplicated logic
* Add pagination to backend
* Pagination
* Add duration and date filter
* Use person header is list view
* type fixes
* bug fix
* bugs and tests
* test fixes
* style filters
* logic tests
* Add another test for team leakage
* fix flaky test
* UX changes
* UX tweaks
* auto focus filter box on open
* add test for recording viewed change
* move duration filter to using a tested logic
* move to clsx
* add debounce breakpoint
* Small style change
* fix debounce
* fix breakpoint
* move test to defaultAPIMocks (merging changes)
* react to url change
We'll be using qemu that ships with docker for mac. I'd updated this at
the same time as zookeeper but obviously never removed the kafka
container from before somehow.
* WIP: Create new property types for simplified cohorts
* Add documentation on simplified_cohort_filter_properties
* Handle static-cohort/precalculated-cohort property types
* Handle new property filters properly
* Add casting
* Test cohorts in more cases
* Fix a bug
* Fix benchmark simplifying
* Avoid redoing work every setup for benchmarks
* Update typing;
* Remove unneeded scope
* Add tests for simplifying and cohorts
* Roll more of "do we need to join persons table" behavior into ClickhousePersonQuery class
* Handle precalculated cohort logic in sessions
* Simplify event query
* More tests without any JSONExtract
* Simplify entity properties as well
* Improve docstring
* Add test for breakdown & precalculated cohorts
* Add test for filtering sessions by precalculated cohorts
* Reset unneeded change
* Update cohort
* Solve some typing issues
* Update benchmarking
* Fix cohort filtering tests
* Fix cohort tests
* Fix a caching issue
* Typecheck
* Handle exclusion filters
* Simplify filters code
* Simplify filters ASAP if filter is created
* Simplify route
* Remove simplification-specific logic from queries
* Remove recursion, update tests
* Pass team in more cases
* Update column optimizer specs
* Test simplify
* Update trends test
* Fix rebase fail
* events dead letter queue CH table
* format
* update schemas
* also store raw payload
* better naming
* make table name more clear
* wip better testing
* remove unused imports
* remove kafka test
* prevent non null test from running on CH migrations
* add kafka testing
* minor tests cleanup
* test naive longer sleep
* make test end-to-end
* address review
* update ttl, format
* refactor delay func, address review
I've been getting lot's of errors with the qemu emulated x86 version.
I'm just changing the arm docker-compose as I don't want my issues with
local dev to affect others.
* fix(correlation): ensure correlation partitioned by team
Previously if distinct_id's were the same between two teams, we'd end up
pulling in the event data between the teams.
* dev(tests): clear cache between partition calls
* fix(correlation): add lower bounds for selected events
Previously we would consider all events for correlation calculation. Now
we use the funnel `date_from` as the lower bounds.
* chore(correlation): exclude funnel steps
* chore(correlation): make sure cache is cleared before each test
* Update funnel success comment
Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
* fix: filter events by team_id
* chore(correlation): remove CTEs from correlation query
There seems to be an issue with the CTEs and production clickhouse, see
https://github.com/ClickHouse/ClickHouse/issues/29748
Instead of risking it, I'm just removing them.
* chore: update entities -> events for funnel step exclusion
* fix team_id = team_id issue
Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
* chore(diagnose): add a stub endpoint for event diagnosis
This adds an insight endpoint that takes a `target_entity` and returns
a list of events ordered by significance of a person reaching
`target_entity`
Followup PRs will add actual calculations but this should act as a
conversation piece around the structure of request and response, as well
as a stub from which UI development can start.
* play around to get mypy typings right
* Sort out test reponse structurea
* refactor: address CR comments
* feat(diagnose): add diagnose stubs for implementation
* feat(funnel): add event correlation calculation implementation
This adds to the `/api/projects/<team_id>/funnel/correlation` endpoint
an implementation that calculates the odds_ratios for each event that a
user that has been part of a funnel, successful or otherwise.
* chore(correlation): get query working
* refactor(correlation): move functions to Query methods
* Always allow filtering on distinct id
* fix
* fix
* remove accidentally commited test
* include table name
* add table specific because distinct_id doesn't exist on person table
Co-authored-by: eric <eeoneric@gmail.com>
* make sure funnel and path dates are always aligned and add api handling for funnel filter persons
* use post instead of GET for paths
* parse label
* change type
* use post in test
* fix types
* test both get and post
Our queries now contain a lot of comment noise that's not relevant when
developing. This change makes PRINT_SQL env variable usable again by
stripping these comments.
* dev(clickhouse): strip out comments before executing sql
This is so we can easily copy/paste from e.g. Metabase by querying the
system.query_log. In metabase is doesn't display new lines (although you
can download to file for this), but it's not very practical.
* test(clickhouse): use `capture_select_queries` in comment strip test
* test(clickhouse): only sub. params if non-insert query
This parallels `clickhouse_driver` behaviour.
* chore(clickhouse): move sql preparation to dedicated function
* refactor: rearrange func and type definitions
* Add asv code
* Get a benchmark running
* better output folder
* Move benchmark file
* Cleanup of config
* Run a query and benchmark
* Skip benchmarks for isort
* Set up materialized columns before test
* Better skipping logic
* Add first proper benchmark, add some documentation
* Person property filtering
* Add new workflow
* Show stderr in test run
* Continue debugging actions
* Try to save benchmark results to separate repo
* Output to main directory
* Scheduling
* Remove if temporarily
* Int for ms
* Comment on the PR
* Collapsible section
* Update README
* Clarification
* Remove h3
* Remove pyproject.toml, .gitignore changes that are unneeded
* Add project-nested version of all project-dependent endpoints
* Fix hook `perform_create`
* Adjust `plugin-configs` to adhere to style of other endpoints
* Test Kafka
* black format python
* fix imports
* add kafka and zk deps for testing
* Include ZK and Kafka for all tests
* fix signature for kafka helper
* Connect to localhost for kafka
* update kafka host for all test runs
* Wrong env var for kafka
* consolidate env vars for github actions
* set the advertised hostname from the broker to localhost
* add env var to docker-compose for kafka broker advert host
* resort to what we do locally with /etc/hosts
* Remove configs for kafka that won't be used
* restore progress
* working connection no UI visual
* working for events
* edit endpoint to start point
* working with close button
* funnel to path work (no dropoff yet)
* run prettier
* make suggested adjustmenst
* Refactor `AvailableFeature` from strings to an enum everywhere
* Fix circular dependency and type
* Add "Per-project access" feature flag, premium feature, and organization switch
* Rename `OrganizationMembershipLevel` to `OrganizationAccessLevel`
* Create `ExplicitTeamMembership` model
* Show whether projects are restricted in the project switcher
* Update organizations API code
* Fix migrations
* Move organization tests that require EE to `ee`
* Revert `OrganizationMembershipLevel` rename
* Fix organization tests
* Update migration
* Fix schema and add Members to Project Settings
* Build out test memberships API with security tests
* Update `TeamMembers` and `teamMembersLogic`
* Move "Per-project access" description to tooltip
* Add moar tests
* Fix Project Members list logic
* Add additional membership checks
* Update migrations
* Fix typing
* Adjust explicit team memberships API similarly
* Fix typo
* Unify `ExplicitTeamMemberSerializer`
* Remove old changes to `membersLogic` usage
* Use `effective_membership_level` on `TeamBasicSerializer`
* Clean up organization update tests
* Explicitly disallow enabling per-project access for free
* Fix circular import
* Remove `id` from `UserSerializer`
* Fix typing
* Try to fix import
* Fix fatal typing
* Add more tests
* Update permissioning.ts
* Add clarifying comment to migration
* Fix import
* Revert `TopNavigation` changes
* Restore `TopNavigation` changes
This reverts commit 05fd9e4ed6.
* Try to add a story for `TopNavigation`
* minor clarifications
* Revert `TopNavigation` changes
* Restore `TopNavigation` changes
* Make new access control entirely project-based
* Update migrations
* Add `project_based_permissioning` to `TeamBasicSerializer`
* Update test_team.py
* Fix `isRestricted` in `ProjectRow`
* Disable project creation for non-admins
* Make project icon in top nav itself dynamic as well
* Fix story
* Delete 0169_project_based_permissioning.py
* Apply suggestions from code review
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
* Update frontend/src/layout/navigation/TopNavigation.tsx
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
* Address feedback
* Project-based permissioning full data access restrictions (#6068)
* Fix Access Control restriction tooltip
* Add `TeamMemberAccessPermission` and use it in viewsets
* Add `ErrorProjectUnavailable` scene
* Ignore mypy
* Update MainNavigation.tsx
* Update explicit_team_member.py
* Fix frontend detection of unavailable project
* Fix some tests and edge cases
* Fix basic permissions
* Add more tests
* Simplify `ExplicitTeamMemberViewSet` permissions
* Improve restrictions and add moar tests
* Update frontend
* Fix a couple of things
* Fix import
* Fix some edge cases
* Fix typing errors
* Use hedgehog instead of moth
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
* Address feedback
* Add proper permissioning to dashboard views
* Update ee/api/test/test_dashboard.py
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
* Run prettier
* Remove debug code
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
* Move Sessions tab -> Session Recording (behind feature flag)
Note: the /scenes/sessionRecordings folder is a copy of /scenes/sessions. Planning to remove sessions from the new SessionRecordings folder over the next coupld of commits
* Add very basic session recording page
* Add session recordings to persons page and session recs can play
* add endpoints for clickhouse
* fix ordering in existing tests
* add basic test to pg and clickhouse
* small bug fix
* type fix
* add test for data leaking between teams
* fix navigation bugs
* Fix name of logic
* Add basic logic tests
* fix tests
* fix laoding state bug
* revert changes to existing session queries
* move to proper queries for session recordings
* type fixes
* rename feature flag
* type fix
* Fix capitalization
* remove showSessions and clean up ifs
* Style changes and refactor SessionPlayerDrawer
* bug fix
* move to using query params
* remove type from persons logic
* Move sessionRecordingTableLogic key to distinctId
* rename setSessionRecordingId to openSessionPlayer
* improve tests
* Cleanup from review
* move team and limit to parameters
* new path tab querybuilder
* prettier
* clean up
* wip
* format querybuidler
* prepare path type filter component
* dropdown
* formatted popup
* change button for endpoints
* styling the type buttons
* logic for all left side querybuilder components
* exclusion UI and logic
* improve exclusion handling, ensure API calls are made
* API fixes for event types
* fix popup on close issue with exclusions
* hide overflow on buttons
* all ui working
* more formatting adjustments
* type fixes
* leave response ambiguous
* feature flagging and adjust styles
* Add Step limit option
* add tooltip to wildcards
* rewrite tooltip for exclusions
* make Events toggle responsive
* fix types
* responsive at xl instead of lg for no overlaps
* Proof of concept of connecting Funnel to Paths
* protecc wip
* Connect Funnels to Paths
* remove funnel button for now
* remove unused
Co-authored-by: eric <eeoneric@gmail.com>
Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
* Export 10k lines in CSV, allow limit= query param
* this should be min
* fix test var
* add limit support to postgres, make tests to check all cases
* update tooltip to say 10k events
* fix 10k event text again
* Refactor `AvailableFeature` from strings to an enum everywhere
* Fix circular dependency and type
* Add "Per-project access" feature flag, premium feature, and organization switch
* Rename `OrganizationMembershipLevel` to `OrganizationAccessLevel`
* Create `ExplicitTeamMembership` model
* Show whether projects are restricted in the project switcher
* Update organizations API code
* Fix migrations
* Move organization tests that require EE to `ee`
* Revert `OrganizationMembershipLevel` rename
* Fix organization tests
* Update migration
* Fix schema and add Members to Project Settings
* Build out test memberships API with security tests
* Update `TeamMembers` and `teamMembersLogic`
* Move "Per-project access" description to tooltip
* Add moar tests
* Fix Project Members list logic
* Add additional membership checks
* Update migrations
* Fix typing
* Adjust explicit team memberships API similarly
* Fix typo
* Unify `ExplicitTeamMemberSerializer`
* Remove old changes to `membersLogic` usage
* Use `effective_membership_level` on `TeamBasicSerializer`
* Clean up organization update tests
* Explicitly disallow enabling per-project access for free
* Fix circular import
* Remove `id` from `UserSerializer`
* Fix typing
* Try to fix import
* Fix fatal typing
* Add more tests
* Update permissioning.ts
* Add clarifying comment to migration
* Fix import
* Revert `TopNavigation` changes
* Add project member addition button+modal
* minor clarifications
* Revert `TopNavigation` changes
* Make new access control entirely project-based
* Update migrations
* Add `project_based_permissioning` to `TeamBasicSerializer`
* Update test_team.py
* Fix Access Control restriction tooltip
* minor improvements
* fix frontend typing
* Fix frontend typing a bit more
* adjust copy & UI a bit
* Address feedback on field comment
* "Privacy settings" to "Access Control"
* Make `FusedTeamMemberType` comment clearer
* Remove useless `export`
* Delete 0169_project_based_permissioning.py
* Clean some code up a bit
* Project-based permissioning member removal (#6067)
* Fix `teamMembersLogic` loaders
* Allow explicit project members to leave
* Add member removal/leaving button to Members with Project Access
* Restore error message
* Fix error message
* Correct things
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
* test(breakdown): add test for week interval rounding overshooting
This refers to https://github.com/PostHog/posthog/issues/2675
* fix(breakdown): resolve week rounding interval over shoot for trends
Previously there was a fix for another issue with weekly intervals not
spanning a large enough range, see
69ba0b1d90
for details.
The issue that this was trying to resolve was consider a date range
date_from, date_to and a week interval. The range can cross two weeks,
but prior to the above commit it would only show one tick/week on the
graph. In this case we just added on another week to show.
This doesn't help however in the case where the range is less than a
week, in which case we'd end up showing a week/tick on the graph with
a zero value.
Instead, we remove the additional 1 week and simply ensure that both
lower and upper bounds are included in the clickhouse zero fill.
Closes https://github.com/PostHog/posthog/issues/2675
* fix(lifecycle): update lifecycle to use updated week interval handling
This is due to the change in the way the week interval is handled in the
previous commi, where we removed a +1 we were adding to week intervals
and thus getting too many date axis ticks on trend graphs.
* ci(tests): only run non-ee tests for non ee action step
It seems that we are segregating tests between ee and non-ee via a
folder structure. This is a bit of a hack, but it works for now but
ideally we should converge on one set of tests for which we identify if
they are supported on clickhouse or not via pytest markers. This should
simplify working with the tests somewhat, e.g. making them easier to
locate, update, and e.g. debug in vscode/codespaces.
* test(trends): correct old week interval test. It was wrong before
Now with the change to how we create the interval, it's fixed.
* fix(trends): avoid including one week too many when deciding on bounds
Previously there was a test in here that was saying that if we request a
graph of events, with week interval ticks starting on a Sunday, we'd
actually end up also including the Sunday before due to some arithmetic
mistakes.
* fix(trends): resolve week interval rounding issues for trends query
* test(identify): update test func to accept `properties` argument
* report on self hosted duplicate ids
* satisfy mypy
* satisfy black
* adjust test to run on ch only
* black
* fix stupid test typo
* black, again
* update report
* format
* fix black pre commit hook
* update query
* report on multiple ids per person
* fix foss test
I was having issues with running the clickhouse/ee tests and it was just
hanging. Clickhouse appeared to be up and I could perform queries with
`clickhouse-client`. For some reason it was hanging on querying, and on closer
inspection if looks like for each of the setup queries it was hanging for 6
seconds, failing to find zookeeper, and then continuing to run setup.
It's pretty useless to continue in this case, so it seems more sensible to raise
in this case.
* split out funnel apis and fix histogram paint order bug
* fix broken tests
* simplify some more
* make this fail if no steps returned
Co-authored-by: Marius Andra <marius.andra@gmail.com>
* refactor(retention): add AppearanceRow dataclass to improve readability
This just makes it a little more clear what is being pulled out of the
database. Previously we were just getting a list of lists.
I haven't done anything else here but will follow up with a fix for
https://github.com/PostHog/posthog/issues/5443
* test(retention): reproduce retention marker index error
* fix(retention): make retention forgiving of too much data from query
This just makes the `appearance_to_markers` method not fail if the
underlying clickhouse query returns more data than expected. It should
just be less efficient than it could be and should still give the
correct results. Previously it would silently fail to include any data
in these cases.
Closes https://github.com/PostHog/posthog/issues/5443
Co-authored-by: Harry Waye <harry@scalexp.com>
* m1 clickhouse support
* add clickhouse arm64 compilation dockerfile
* use clang-12 and 2 parallel builds
* working clickhouse docker image
* this needs to be committed out for CH to work... a known issue. WIP
* move things around
* move things around again
* add arm64 build scripts
* comment out broken line in DEBUG mode, still make it break production builds
* update readme
* timeless text
* add issue in comment
* way way way too much white space
* zookeeper restarts sometimes needed
* Revert "Revert "Swap out old paths querying class with new (#5821)" (#5886)"
This reverts commit 82ef50a1e7.
* remove old ref
* test 3.9 general
* test if there's overlapping
* change version back
* make timestamp dynamic
* change funnel path type to str
* change include_timestamp_step name
* type issues
* add argument
* add type
* explicit none check
* change field names
* change constant name
* between step test
* use different arguments for defining funnel steps and add tests
* after step test
* fix types
* test for valueerror
* add test for before dropoff
* custom logic for finding paths up to a dropoff
* fix type
* update test
* add comment
* change event names in test to be clearer
* run again
* test without caching
* return caching
* try not caching again
* try not caching again
* try not caching again
* restore caching
* remove funnel_window_days
* remove unused import
* Raise ValidationError if "math" without "math_property" passed to BE from FE
BE side fix for https://github.com/PostHog/posthog/issues/5756
* Update ee/clickhouse/queries/trends/util.py
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
* Update typing
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
* swap out old paths querying class with new
* swap arguments
* swap name
* delete old CH paths file
* dont error out in calculate_by_filter
* write some backwards compatible tests for paths
* remove expanding autocapture element ability
* cleanup
* delete old code
Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
* Move api/action/people SQL code under ee/clickhouse/queries
* Move api/action/people SQL code into a class
* Fix rebase
* Calculate Trends people via TrendsEventQuery
This should significantly speed up the query. In testing, this took one
query from 10s -> 1s.
We can reuse almost all of the plumbing in TrendsEventQuery.
* Update insert_entity_people_into_cohort
* Fix date handling in trends people, add in-depth tests for each interval
* Standardize code style a bit
* Make tests less TZ dependant
* Skip failing tests on-not-ee
* Document
* WIP: flamegraphs
* Get flame graphs generating
* Add files to bin
* Crude frontend for analyzing
* Hack: Use a stable clickhouse host instead of conn pool for flamegraphs
Otherwise no way to get back measurements due to LB.
* Error handling
* Only allow read queries
* Hide query analyze button for non-owners
* Make sure non-admins can't run queries
* Fix query issue
* fix person modal across multiple dates
* test works for pg but shouldn't for ee
* wrong number
* make it cumulative relevant
Co-authored-by: eric <eeoneric@gmail.com>
* Add command for materializing columns
Expecting this to get used in both dev as well as when improving
upstream installations
* No clashes in tests
* Solve for feedback
* Comments for clarity
* Make breakdown join with person if needed
* Refactor trends to be purely class-based, don't rely on wonky inheritance
* Extract method
* Improve person join behavior
* Remove unneeded parameter
* Mark a function thats always passed as such
* Add test case demonstrating previous non-join case
* Unify two get_breakdown_prop_values methods
* Add test for materialized columns
* Simplify trends breakdown query
* Unify _breakdown_prop_params for events/person breakdowns
* Use shared column_optimizer
* Typing fix
* Cleanup
* Code style cleanup
* Code style cleanup
* Fix param ordering
Closes https://github.com/PostHog/posthog/issues/5808
I'd love to fix this at the schema level but looked into it for ~20
minutes and it didn't seem like there's a pretty solution that allows to
pass `None` to .objects.create and for the default to be used.
Other solutions would be even more invasive and require manipulating
serializers.
Best leave this to when we refactor all of out `properties` JSONFields
since they all have this issue
* Hotfix: Use materialized columns on cloud
This was broken since default_kind was different on Distributed tables
on cloud
* Improve __init__.py
* Make reverting DEFAULT column async, only ON CLUSTER for events table
* ColumnOptimizer: Add functionality for person materialized columns
* WIP: Use person properties in trends/funnels
* Test person materialized props in trends cohort breakdown query
* Make use of materialized person properties in breakdowns
* Mark some cases working with materialized columns
* Test and fix breakdown by person props without filtering
* Make filtering by entity/person props on a join work better
By not assuming everything is under `properties`
* Add test case around breakdown with person properties
* Add test cases around materialization
* Add another materialization test
* Test cohorts and fix breakdowns with person filter
This exposes a limitation in the current implementation
* Fix some cohort tests
* Fix event query tests
* Get a funnel materialized column test running
* Cover more funnel breakdown tests with materialized
* Handle person property breakdowns in funnels
* Fixup funnel typo
* Add tests, fix an indentation issue
* TestFunnelPersons with materialized columns
* Test funnels against actions with person filters
* Add failing test for entity filtering failing
* Add test case for filtering with entity properties
* Show my 'broken' test is actually doing a subquery
* Resolve linting issues
* Avoid naming collisions when materializing columns
1. Prefix person properties differently. Mixing them up can break
ambigious column issues
2. When name already exists, suffix with random junk :)
* Implement analyze.py
* Add `suggested_columns_to_materialize`
* Add code to backfill a materialized column
* Add tests for backfilling data
* Cleanup
* Add tests for analyze
* WIP: Crontab for materializing columns
* Nooped task for materializing properties
* Use mutations_sync=0 for column tests
* Add comment
Looking at the generated SQL it has bothered me that the list of entity
names is not unique for funnels in queries like `event IN [somearray]`
This tries to fix that.
* Speed up EE tests by not destroying tables
* Fix broken tests
* Speed up tests by not running migrations
* Fix last test
* req file?
* caching
* Parallel
* revert exp
* debug without parallel
* Revert "debug without parallel"
This reverts commit 83b3ad633f.
* Undo parallel tests
* Speed up more tests
* use final
* correct final
* print exception
* more prints
* move test
* add filter
* remove duplicate test
* prints here
* test wait
* set variable in query
* remove mutations_sync
* cleanup
Co-authored-by: eric <eeoneric@gmail.com>
* Remove dead argument
* Make allow_denormalized_props always explicit
* Change prop_clauses default
* Create a testing decorator for checking materialized columns
This makes it easier to have proper test coverage for materialized
columns and make sure no bugs creep up :)
* Fix event_query
* Test more materialized columns in trends
* Add materialized column tests for funnels
* Cleanup path_event_query
* Fix default
* Fix issue with clashing parameter names
* initial implementation
* debug some tests and revert format to original
* some minor cleanup
* add screen handling
* start point handling
* improve indexing so multiple sessions by the same user are handled properly
* all tests passing
* fix type
* fix types
* change types
* more types
* rename base paths
* upgrade start point functionality
* assertEquals, remove inequality
* Revert "assertEquals, remove inequality"
This reverts commit 5eb229fef7.
Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
* Fix fetching event-based breakdown values with `LIMIT`
* Improve test comment
* Limit prop clauses inclusion to breakdown queries
* Address feedback partly
* Fix imports
* Remove non-3.7-compatible `Literal`
* Don't try to import `Literal`
* Fix oversight
* Always include prop filters in `get_entity_filtering_params`
* Revert "Always include prop filters in `get_entity_filtering_params`"
This reverts commit 4f61edd19a.
* Add and test handling of actions in addition to events
* Update test_funnel.py
* Move new tests to `breakdown_cases`
* Fix `icontains` and support `href/`text` element filters
* Test `is_set`/`is_not_set` too
* Require newer `flake8` to support Py 3.8 walrus operator
* Better handle empty mutlivalue operators and support doublequotes
* Polish all element filtering cases
* Roll back general `icontains` fix
* Make minor improvements
* WIP: port process_math to support materialized columns
* Add skipped test showing trend breakdowns dont use materialized columns
* Simplify testing and test&fix math property aggregation w/ materialized columns
* Add (failing) test for filtering with materialized action props
* Add test around materialized property filtering
* Refactor entity.math materialization impl
* Make trends breakdowns work with materialized columns
* Simplify process_math further
* Handle denormalized properties in format_action_filter for step.properties
Note the following files all called this method:
ee/clickhouse/views/events.py
ee/clickhouse/views/actions.py
ee/clickhouse/queries/trends/util.py
ee/clickhouse/queries/trends/lifecycle.py
ee/clickhouse/queries/trends/breakdown.py
ee/clickhouse/queries/funnels/base.py
ee/clickhouse/queries/sessions/util.py
ee/clickhouse/queries/clickhouse_stickiness.py
ee/clickhouse/queries/clickhouse_retention.py
ee/clickhouse/models/cohort.py
I verified all of them are OK since they query events table directly
with the passed filter
* Handle materialized $current_url in action step filtering
* Remove now unneeded clause
* Update test helper
* Allow denormalized props for filtering with breakdowns
* Allow denormalized props for filtering with lifecycle
* Allow denormalized props for some views
* Fix entity math yet again
* Query materialized columns in insights > sessions
* Handle breakdown edge case
* Allow denormalized props for more views
* PR feedback
* reformat
* Add test cases for calculation of cohort-based cohorts
* Add cyclic dependency test
* Add support for cohort-based cohorts
* Reraise error in `calculate_people_ch` to fail loudly
* Use feedback
* Update `test_error_while_calculating`
* Move CH test case to CH suite
* Fix funnels and code formatting