Discard the workspace

WarningContent review status

This page contains unreviewed content created with large language model (LLM) tools.

Finish the workspace example in the same Python session. Discard the workspace, inspect the retained audit record, and then delete that record permanently.

1 Discard the changes

exp.commit() would merge the workspace into its parent. This example discards the changes instead:

exp.discard()
print(ds.lineage(key))
print([(record.name, record.attempt) for record in ds.discarded_workspaces()])
old = ds.discarded("int8-bold")
print([entry.kind.value for entry in old.history(key).entries], old.lineage(key).lossy)
print(len(old.lineage_table()), "rows")
None
[('int8-bold', 1)]
['ingest'] True
15 rows

Discard removes the overlay’s arrays and tables, so the base dataset remains unchanged. It archives the workspace record, journal, and producer metadata; lineage remains available even though the int8 array cannot be read. Reopening int8-bold creates a clean workspace. Each later discard creates a new numbered attempt, selectable with ds.discarded("int8-bold", attempt=n). Call purge() to delete one archived attempt permanently:

removed = old.purge()
print(len(removed) > 0, ds.discarded_workspaces())
True []
WarningA store that cannot delete

If the underlying store does not support deletion, discard can only remove the workspace logically. Its bytes and metadata remain at the overlay location, and the workspace name cannot be reused until a deletion-capable store purges the retained data.

2 Where to next