Skip to content

Allow copy() to save directly to disk via a urlpath parameter #632

@Jacc4224

Description

@Jacc4224

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().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions