On Tue, Oct 10, 2023 at 7:03 AM Ronald van Elburg <
r.a.j.van.elb...@hetnet.nl> wrote:

> I have one more useCase to consider from our ecosystem.
>
> We dump numpy arrays into a MongoDB using GridFS for subsequent
> visualization, some snippets:
>
> '''Python
>         with BytesIO() as BIO:
>             np.save(BIO, numpy_array)
>             serialized_A = BIO.getvalue()
>         filehandle_id = self.representations_files.put(serialized_A)
> '''
>
> and then restore them in the other application:
>
> '''Python
> numpy_array = np.load(BytesIO(serializedA))
> '''
> For us this is for development work only and I am less concerned about
> having mixed versions in my database, but in principle that is a scenario.
> But it seems to me that for this to work the reading application needs to
> be migrated to version 2 and temporarily extended with the NumpyUnpickler
> before the writing application is migrated. Or they need to be migrated at
> the same time. Is that correct?


np.save and np.load will use NumpyUnpickler under the hood so you won’t
have any issues, you would only have issues if you saved or loaded pickles
using the pickle module directly.



> _______________________________________________
> NumPy-Discussion mailing list -- numpy-discussion@python.org
> To unsubscribe send an email to numpy-discussion-le...@python.org
> https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
> Member address: nathan12...@gmail.com
>
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to