Applies to:
- Plan - Any. Retention automations require Enterprise.
- Deployment - Any
- Use case - Age out datasets and experiments, or remove one person's records from them
Summary
Retention automations delete datasets and experiments once they pass a retention period. Deleting a single dataset record doesn’t erase it: the record stays in earlier versions of the dataset and in experiments that ran on it. To remove one person’s records, find them with SQL, rebuild the dataset without them, and delete the original dataset and the affected experiments.What is happening
Datasets are versioned so that experiments can pin to a specific version. Deleting a record adds a new version without it, so earlier versions still contain the record. You can read any earlier version with theversion parameter of the SQL API, and restoring a snapshot saved before the deletion brings the record back.
Experiments are separate objects. Each experiment row stores the input and expected values of the record it ran on, so deleting the record from the dataset doesn’t change experiments that already used it.
Fix or suggestion
Age out data with retention automations
Create a retention automation for experiments and for datasets. For experiments, the automation deletes the entire experiment once its creation timestamp passes the retention period. For datasets, it deletes the individual records that are older than the retention period, and the dataset remains.Remove one person’s records
-
Find the person’s records. Store their identifier in the same top-level
metadatafield on every record, such asmetadata.customer_id, then query on the Query page or through the SQL API. To search several objects at once, pass more than one ID to the data source:Run the same query withexperiment('<EXPERIMENT_ID>')to find matching experiment rows. - Rebuild each affected dataset without the person’s records. Copy the records you want to keep into a new dataset, as shown in Copy records to another dataset, and skip the person’s records.
-
Delete the original dataset after you confirm the new one is complete. Go to Datasets, select the dataset, and click Delete, or run
bt datasets delete. -
Delete the experiments that contain the person’s records, for example with
bt experiments delete. Deleting only the matching experiment rows leaves them readable in earlier versions of the experiment, the same way dataset record deletions do.