How to save a large "database" class in python

I am doing a project with the foundation of a large database. This is not a test DB file, but a class with the format as follows: DataBase.Nodes.Data=[[] for i in range(1,1000)]fe this database combines something like several thousand rows. The Fisrt question is the way I'm efficient, or is it better to use SQL or any other “correct” DB that I have never used. And the main question is - I would like to save mine DataBase classwith the whole record, and then reopen it using Python in a different session. Is it possible which tool should I use? cPickle - it seems, only for lines, any other?

Matlab has a very useful functionality called save workspace - it saves all your variables to a file that you can open in another session - this will be useful for python!

+3
source share
3 answers

Pickle (cPickle) can handle any (picklable) Python object. So, until you try to paint a thread or file descriptor or something like that, you're fine.

+3
source

Pickle should be able to serialize the data for you so that you can save it to a file.

, RDBMS, , SQLLite , MongoDB

+2

The Pickle.dump function is very similar to the matlab save function. You just give it the object you want to serialize and a file-like object to write it to. See the documentation for information and examples of how to use it.

The cPickle module is similar to Pickle, but it is implemented in C, so it can be much faster. You should probably use cPickle.

+1
source

Source: https://habr.com/ru/post/1748869/


All Articles