Cheok Yan Cheng
Cheok Yan Cheng

Reputation: 42700

Use Python to read data written by Java

Currently, due to migration process, I need to use Python to read data, which are previously written by Java.

Here is one of the data written by Java - UserDatabase

PersistenceManager pm = PMF.get().getPersistenceManager();
UserDatabase user_database = new UserDatabase(email, date, checksum, version, content_list, total_byte);
pm.makePersistent(user_database);

I was wondering, is there any proper way for me, to use Python to read the old data, which is written by Java previously?

As far as Python as concern, Python will expect some "hidden" field from the entity. For instance, key_name. The information is not found in Java's data.

Upvotes: 0

Views: 62

Answers (1)

Nick Johnson
Nick Johnson

Reputation: 101149

Yes - just create models in Python that match the structure of the data written by the Java app (or observed in the datastore viewer), or use db.Expando to define a class that accepts any fields.

Python requires no 'hidden fields' - key_name is a way of specifying the name field of the entity's key when it's being created.

Upvotes: 1

Related Questions