Background
copy() already performs a deep, compacted in-memory copy of a CTable. save() writes an in-memory table to disk but blocks on views. There is no single call that copies a table (or a view) directly to a new path on disk.
Proposed behaviour
- Add an optional
urlpath parameter to copy().
- When
urlpath is provided, the copy is written to disk instead of memory, equivalent to copy() followed by save().
- This naturally unblocks saving views to disk: a view copied with
urlpath produces a new standalone compacted table containing only the view's rows and columns.
Example
import blosc2 as b2
t = b2.CTable(Row)
t.extend(rows)
# In-memory copy (current behaviour, unchanged)
t2 = t.copy()
# Copy directly to disk (proposed)
t.copy(urlpath="my_table.b2d")
# Also works on views — saves only the filtered rows/columns
view = t.where(t["price"] > 100)
view.copy(urlpath="filtered_table.b2d")
Notes
This makes saving views to disk a first-class operation without needing to relax the block in save().
Background
copy()already performs a deep, compacted in-memory copy of a CTable.save()writes an in-memory table to disk but blocks on views. There is no single call that copies a table (or a view) directly to a new path on disk.Proposed behaviour
urlpathparameter tocopy().urlpathis provided, the copy is written to disk instead of memory, equivalent tocopy()followed bysave().urlpathproduces a new standalone compacted table containing only the view's rows and columns.Example
Notes
This makes saving views to disk a first-class operation without needing to relax the block in
save().