Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Basic data storage with Python

I need to store basic data of customer's and cars that they bought and payment schedule of these cars. These data come from GUI, written in Python. I don't have enough experience to use a database system like sql, so I want to store my data in a file as plain text. And it doesn't have to be online.

To be able to search and filter them, first I convert my data (lists of lists) to the string then when I need the data re-convert to the regular Python list syntax. I know it is a very brute-force way, but is it safe to do like that or can you advice me to another way?

like image 719
erkangur Avatar asked Nov 29 '22 19:11

erkangur


1 Answers

It is never safe to save your database in a text format (or using pickle or whatever). There is a risk that problems while saving the data may cause corruption. Not to mention risks with your data being stolen.

As your dataset grows there may be a performance hit.

have a look at sqlite (or sqlite3) which is small and easier to manage than mysql. Unless you have a very small dataset that will fit in a text file.

P/S: btw, using berkeley db in python is simple, and you don't have to learn all the DB things, just import bsddb

like image 66
ntcong Avatar answered Dec 05 '22 13:12

ntcong