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

Or property filtering API #8012

Merged
merged 30 commits into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ee/clickhouse/models/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ def format_action_filter(
conditions += event_conditions

if step.properties:
from ee.clickhouse.models.property import parse_prop_clauses
from ee.clickhouse.models.property import parse_prop_grouped_clauses

prop_query, prop_params = parse_prop_clauses(
Filter(data={"properties": step.properties}).properties,
prop_query, prop_params = parse_prop_grouped_clauses(
Filter(data={"properties": step.properties}).property_groups,
prepend=f"action_props_{action.pk}_{step.pk}",
table_name=table_name,
person_properties_mode=person_properties_mode,
Expand Down
4 changes: 2 additions & 2 deletions ee/clickhouse/models/cohort.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,10 @@ def format_filter_query(cohort: Cohort, index: int = 0, id_column: str = "distin


def get_person_ids_by_cohort_id(team: Team, cohort_id: int, limit: Optional[int] = None, offset: Optional[int] = None):
from ee.clickhouse.models.property import parse_prop_clauses
from ee.clickhouse.models.property import parse_prop_grouped_clauses

filters = Filter(data={"properties": [{"key": "id", "value": cohort_id, "type": "cohort"}],})
filter_query, filter_params = parse_prop_clauses(filters.properties, table_name="pdi")
filter_query, filter_params = parse_prop_grouped_clauses(filters.property_groups, table_name="pdi")

results = sync_execute(
GET_PERSON_IDS_BY_FILTER.format(
Expand Down
174 changes: 143 additions & 31 deletions ee/clickhouse/models/property.py

Large diffs are not rendered by default.

Loading