4

I want to use txt files as database. Is there any advice, like a list of best practices, for people who want to use txt files as database? For example:

  • Should I use only one-line files, avoiding carriage return, etc?
  • Should the file be ASCII, ANSI, UNICODE, or anyone is good?
  • Should I keep the files clean from some specific set of ASCII, ANSI, UNICODE characters (etc) that could corrupt the data?
  • Should I use CSV or TSV or TXT or anyone is good?
  • etc...

Please, any help would be apreciated. For me, txt files seems as the perfect solution, but may be something I cannot see for now that could put me in trouble.

strajano
  • 57
  • 2
  • 7
  • Don't. When you can't rely on a database connection or something like that, make your life easy and try XML or Json :) – Cataklysim Jun 21 '18 at 12:41
  • What about SQLite? – Josef Korbel Jun 21 '18 at 12:49
  • SQlite is binary I guess. I will stick to XML or Json, in order to avoid possible (certain?) future headaches :) – strajano Jun 21 '18 at 12:59
  • Text files (including XML and JSON) are "documents". Databases are usually thought of as something different. Do you intend to use some sort of database library for your data? If so, does it have a "driver" for formats you are considering? – Tom Blodget Jun 21 '18 at 13:39
  • I want (need) to create a simple database "system", for storing of strings-like data, that can be easily accessed by Word-VBA, Excel-VBA, Python and AutoIT. – strajano Jun 21 '18 at 13:52
  • [crates.io-index](https://github.com/rust-lang/crates.io-index) uses jsonlines format, which i think is wasteful. for such data i would use a positional schema like CSV or TSV, which is smaller to store and faster to read. what i find challenging is [ascii to ascii compression](https://stackoverflow.com/questions/4812311/how-can-you-reversibly-compress-a-bit-of-text-into-fewer-ascii-characters) – milahu Mar 12 '22 at 14:02

0 Answers0