How to easy generate Person.Blob_data in sqlite?

How to easy generate Person.Blob_data column in sqlite?
I waana migrate my own database into gramps by inserts. Not via xml.
tnx

Maybe use the SQLite export addon mentioned in Simple way to access blob data? - #4 by GeorgeWilmes

You can use the database API to insert objects into the database. It will serialise and pickle the data into the correct format.

It is also possible to write your own exporters and importers. Use the SQLite addons code as an example.

I want to work with the database as a database, and not as an API application or through application interfaces. Can anyone tell which algorithm is in the formation of this field? is it possible to repeat it on SQLite yourself.

We first convert the object into a hierarchy of simple python data types by calling the serialize method. Then this is converted into binary using python’s pickle module.

No. The algorithm is part of Python, and may be subject to change. You can add new data to a database in the SQLite export format, which can then be imported to Gramps later, but if you do that, you must make sure that every row has a valid and unique handle.

ok. i understand, cant operate by SQL. i think for last 2 years - WHY it cant be easy without blob fields… its a global problem for fair play with base. its a problem when u wanna to synch with other sites or bases, when u want to update you 2200 person with pure SQL without addons… i hope in future it will be not so!

If you update the mongodb DB-API driver for Gramps, you could use mongodb as database and make a connection/link to it from any sql database and sync anyway you like… no blobs or pickles…

But as it is now, the driver packed for AIO does not work with the latest MongoDB…

1 Like

You can always export to normalized SQLite, modify that, and import again, into a new database. Adding new objects may not be so easy though, because they must have proper handles.

We have blobs for a reason, and I don’t see them disappear anytime soon, because the conversion to pure normalized SQL is a lot of work, and it may also slow down the program. Reading and writing a blob is quite fast, and model changes are also easy to implement, if they appear inside the blobs.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.