pilgr / Paper

Paper is a fast NoSQL-like storage for Java/Kotlin objects on Android with automatic schema migration support.
Apache License 2.0
2.35k stars 234 forks source link

[ASK] How can view the contents of a PT file #207

Closed BobFactory closed 1 year ago

BobFactory commented 1 year ago

Hi,

I wish to implement a database viewer in my app. I play a lot with my local database so I need a way to constantly view the data that is being persisted or modified.

From the documentation, I figured it was internally saving .pt files. But I cannot find a way to view the contents of a .pt file. From scouring the internet I only get suggestions that this is a PyTorch file.

I attempted loading the .pt file using PyTorch but that too failed. Can you suggest a way through which I can view the contents of a .pt file ?

pilgr commented 1 year ago

Paper DB is not a traditional DB. You may think about Paper DB as key-value storage, or HashMap that can be stored on disk.

So you can't load the content of .pt file without having access to the same classes that has been used to save data.

Every time you save data, the objects are serialized using Kryo serializer and .pt file is getting rewritten using new set of data. To deserialize the data, Kryo reads file content and tries to makes objects for the classes that has been used to save data.