Skip to content

Store conversion methods #137

Closed
Closed

Description

@jakirkham

As follow-up/an extension to discussion in issue ( https://github.com/alimanfoo/zarr/issues/129 ), it would be pretty handy to have some methods to convert back and forth between DirectoryStore and ZipStore. Given that Zip files really are best treated as a write once medium, this would allow one to write out to a DirectoryStore and then convert to a ZipStore. Similarly if editing needs to occur, one could extract the ZipStore and perform edits on the DirectoryStore and then archive it afterwards.

Activity

  1. jakirkham commented on Mar 1, 2017

    @jakirkham
    MemberAuthor

    Musing on this a bit, maybe leveraging the update methods from the MutableMapping interface might be better. One would then provide it the store they would like to move their data to. For instance, converting to a DirectoryStore or a TempStore should be able to follow similar code paths, which should just work thanks to inheritance. This should also allow it to remain extensible in the future.

  2. changed the title [-]Adding to_zipfile/to_dir methods[/-] [+]Store conversion methods[/+] on Mar 1, 2017
  3. alimanfoo commented on Mar 1, 2017

    @alimanfoo
    Member
  4. alimanfoo commented on Mar 1, 2017

    @alimanfoo
    Member

    I think it would be worth adding an example to the tutorial to show how to copy data from one store to another.

  5. added this to the v2.2 milestone on Nov 19, 2017
  6. jakirkham commented on Nov 20, 2017

    @jakirkham
    MemberAuthor

    Just to clarify, we are thinking of this as a docs/examples item? If so, I think I agree. The existing interface is already sufficient, but a couple line example would be good. Any thoughts on where this would be documented?

  7. alimanfoo commented on Nov 20, 2017

    @alimanfoo
    Member
  8. jakirkham commented on Nov 20, 2017

    @jakirkham
    MemberAuthor

    No complaints from me. This is somewhat similar to how I imagined the Group copy method. Does that fit the use cases you are imagining here or do you see other benefits from handling this at the Store level instead of the Group level?

  9. alimanfoo commented on Nov 20, 2017

    @alimanfoo
    Member

    I was thinking there is potentially a use for both a low-level zarr.copy_store(source, dest, ...) where source and dest are store objects, and a higher-level zarr.copy(source, dest, ...) where source is array-like or group-like and dest is group-like.

    The low-level copy_store() is for the case where you want to replicate data exactly, and so you just copy key/value pairs from one store to another, which is going to be faster because there is no need to decompress/recompress chunks, and because only initialized chunks will get copied.

    The higher-level copy() would be for a more general case where you want to copy an entity (group or array), going via the create_group/create_dataset API. This could mean potentially that source and dest could be anything array- or group-like, e.g., either zarr or h5py, i.e., this would provide a way to migrate data between two zarr hierarchies, or zarr to/from h5py. This could also allow for copying but using different compression to store data in the destination than is used in the source.

  10. jakirkham commented on Nov 20, 2017

    @jakirkham
    MemberAuthor

    I see. Sure that seems fine.

    My initial thinking with copy was that it would special case Zarr objects and thus handle direct data replication with the performance of copy_store, but through the same easy high level interface.

  11. alimanfoo commented on Nov 21, 2017

    @alimanfoo
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew features or improvements

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions