0

I need to store multiple tables (say, CSVs) in one file. Is there any spec or standard I can follow?

I tried queries such as "multi-csv standard" and "single file plaintext database" with little to show.

Who would be responsible for creating such a standard?

Here is one plausible option:

# TABLE colors
name,hex
red,ff0000
blue,0000ff

# TABLE users
id,name,followers
1,bob,5
2,alice,33

Why not a directory of tables?

  • An empty directory is not acknowledged by git
  • Hassle to send over network in one transaction (tar/untar or zip/unzip)

See also

Luke Miles
  • 941
  • 9
  • 19
  • The sqlite answer to this is "the sqlite database format", not the output of a .dump command. But the general answer is "it depends", there's no single answer, just like csv files aren't always the best answer to sharing a single table of data. – Anon Coward Mar 04 '22 at 01:21
  • Sqlite db files are not plain text tragically. I was searching for some way to escape the "it depends" but it seems I must choose for myself. – Luke Miles Mar 04 '22 at 03:49
  • 1
    I think there is not a standard for CSV or TSV, these are single table format. Other text formats - as yaml or json - could contains inside multiple tables. But what's your goal? – aborruso Mar 04 '22 at 07:12
  • 1
    And the JSONlines could be a way to do it https://gist.github.com/aborruso/d8b92c7974c3a71e81898787668ac405 – aborruso Mar 04 '22 at 07:34
  • Json may be the best option. You can also make a row more compact with just `{table: "colors", "row": ["red","ff0000"]}` or even all the rows in one rectangular array – Luke Miles Mar 05 '22 at 18:43

0 Answers0