Unsolved SQLite or CSV?
-
I'm currently working on a program reads a live chat log and alerts you when certain things are said in the chat log. I was originally planing on using a CSV file to refrence the chat log but the file was much larger than what I was expecting, 84MB, 503051 rows 15 columns. This is a read only program nothing will ever be written to the csv file.
What I was wondering what would be the efficient way to use this file? just leave it as a CSV or embed SQLite into the program.
-
Hi
Well besides that CSV text file demands careful handling of "", etc
its also important to consider if you want to filter/sort/ look around in the data.
In that case SQL db provides many benefits.
Also a powercut might corrupt the text file
where as transactions and sqlites db format
makes that more unlikely to happen.So it also depends on what you consider + or minuses and the general use case.
-
@mrjj is correct. CSV, being a flat file, has lots of CONs when trying to manipulate the data and is really only good for simple data transfer. A good SQLite3 database gives all kinds of benefits. Sorting, filtering, querying parameters, compact, etc.
SQLite3 is used by Android phones for their messaging. It is used by Mozilla for all kinds of settings and attributes. It is public, robust, and well supported. Its an all around win! The best part about using SQL is that if you ever need to go BIG... change the driver and the code still works as expected.
As a note, I use it in embedded applications for alert management, sensor plug-n-play, and settings for global and user centric and it performed great.
-
Just to add, for logs xml is a popular option that is not affected by the drawbacks of csv. A lot of programs use this format for logs