Skip to content

Commit c59803b

Browse files
authored
feat(deletes): add support for delete by attribute in config (#7534)
Add support to create an allowlist for attributes where lightweight deletes can be used against eap_items. Set it to the single possibility of `group_id` for type `occurrence`
1 parent bde13e8 commit c59803b

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

snuba/datasets/configuration/events_analytics_platform/storages/eap_items.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ deletion_settings:
147147
- organization_id
148148
- trace_id
149149
- item_type
150+
allowed_attributes_by_item_type:
151+
occurrence:
152+
- group_id
150153

151154
mandatory_condition_checkers:
152155
- condition: OrgIdEnforcer

snuba/datasets/configuration/json_schema.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,14 @@ def registered_class_array_schema(
615615
"type": "integer",
616616
},
617617
"bulk_delete_only": {"type": "boolean"},
618+
"allowed_attributes_by_item_type": {
619+
"type": "object",
620+
"description": "Mapping of item_type to list of allowed attributes for deletion.",
621+
"additionalProperties": {
622+
"type": "array",
623+
"items": {"type": "string"},
624+
},
625+
},
618626
},
619627
"required": ["is_enabled", "tables"],
620628
"additionalProperties": False,

snuba/datasets/deletion_settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
from dataclasses import dataclass, field
4-
from typing import Sequence
4+
from typing import Dict, List, Sequence
55

66
MAX_ROWS_TO_DELETE_DEFAULT = 100000
77

@@ -13,3 +13,4 @@ class DeletionSettings:
1313
bulk_delete_only: bool = False
1414
allowed_columns: Sequence[str] = field(default_factory=list)
1515
max_rows_to_delete: int = MAX_ROWS_TO_DELETE_DEFAULT
16+
allowed_attributes_by_item_type: Dict[str, List[str]] = field(default_factory=dict)

0 commit comments

Comments
 (0)