News for hackers. Stuff that matters.
Re:Why isn’t there a decent file format for tabular data? by asperous on Tuesday May 03, 2022 @09:28PM (#31255775)
Seems like the problem here is there is several high quality and well-developed formats, but the author and the commenters here dismiss them because of the different trade-offs they make.

csv -- Simple for simple use cases, text-based, however many edge cases, feature lacking etc

xlsx -- Works in excel, ubiquitous format with a standard, however complicated and missing scientific features

sqlite -- Designed for relational data, somewhat ubiquitous, types defined but not enforced

parquet / hdf5 / apache feather / etc -- Designed for scientific use cases, robust, efficient, less ubiquitous

capn proto, prototype buffers, avro, thrift -- Has specific features for data communication between systems

xml -- Useful if you are programming in early 2000s

GDBM, Kyoto Cabinet, etc -- Useful if you are programming in late 1990s

Pick your poison I guess. Engineering is about trade offs.

Re:Why isn’t there a decent file format for tabular data? by PeterisP on Wednesday May 04, 2022 @12:23AM (#31256739)
I've seen ubiquitous use of tab-separated value files instead of csv, as as simpler format without quoting support and a restriction that your data fields can't contain tabs or newlines, which (unlike commas) is okay for many scenarios.
Re:Why isn’t there a decent file format for tabular data? by wodenokoto on Wednesday May 04, 2022 @01:06AM (#31256950)
But that’s sort of the problem with csv.

You never really know which rules your csv files has. Many .csv files are indeed tab separated.

Re:Why isn’t there a decent file format for tabular data? by lordnacho on Wednesday May 04, 2022 @02:14AM (#31257272)
Gotta wonder why the format isn't just a column separator char, a row separator char, and then all the data guaranteed not to have those two chars. Then you could save the thing by finding any two chars that aren't used in the data.

I guess this is why we have a zillion formats.

Re:Why isn’t there a decent file format for tabular data? by Brometheus on Wednesday May 04, 2022 @03:27AM (#31257712)
ASCII Code 29: Group Separator

ASCII Code 30: Record Separator

ASCII Code 31: Unit Separator

https://theasciicode.com.ar/ascii-control-characters/record-...

Re:Why isn’t there a decent file format for tabular data? by kbouck on Wednesday May 04, 2022 @05:23AM (#31258316)
this doesn't directly address the ease-of-editing concern, but if you have csv (or tsv) and want ascii (0x1f, 0x1e) or unicode(U+241F, U+241E) separated (or vice versa), 'miller' [0] is a command line tool that supports converting among these formats with these one-liners:

    mlr --icsv --oasv cat input.csv  # csv to asv
    mlr --iasv --ocsv cat input.asv  # asv to csv
[0] https://miller.readthedocs.io/en/latest/

[1] https://miller.readthedocs.io/en/latest/file-formats/#csvtsv...

Re:Why isn’t there a decent file format for tabular data? by jph on Wednesday May 04, 2022 @03:16PM (#31264656)
You're right, Miller is great for this, and it turns out that Miller already offers Unicode Separated Values (USV).
Re:Why isn’t there a decent file format for tabular data? by srik on Wednesday May 04, 2022 @04:19AM (#31257992)
Thank you for pointing them out. I've browsed, and searched through that ascii table countless times, usually looking for something in particular, yet never realized that there were such a thing as separators before.
Re:Why isn’t there a decent file format for tabular data? by cestith on Wednesday May 04, 2022 @02:47PM (#31264321)
It makes more sense to me in these days of ubiquitous encoding of in-band data that it would be easier to edit if we just used tabs and newlines. If you need a tab in your data, the standard could support either \t (requiring \\t if you need a literal backslash followed by a literal 't') or %09 or &09; or \x09 or something.
Re:Why isn’t there a decent file format for tabular data? by account42 on Thursday May 05, 2022 @11:04AM (#31274286)
If you require escaping then you may as well stick with csv - better to have the character that needs to be escaped to be common enough that people will run into it during testing.
Re:Why isn’t there a decent file format for tabular data? by cestith on Thursday May 05, 2022 @12:38PM (#31275547)
My actual preference is LTSV. Then all that needs escaping or encoding is a quote since a tab or newline inside the quotes is different from one outside the quotes. And I prefer encoding to escaping generally, since it's easier for someone else to come along and build a fairly naive parser.
Re:Why isn’t there a decent file format for tabular data? by chimprich on Wednesday May 04, 2022 @04:53AM (#31258161)
> Gotta wonder why the format isn't just a column separator char, a row separator char

That's what the article proposes.

Re:Why isn’t there a decent file format for tabular data? by m_eiman on Wednesday May 04, 2022 @02:42AM (#31257442)
Then you can't edit or view it in a normal text editor, which is part of the appeal of CSV.
Re:Why isn’t there a decent file format for tabular data? by ant6n on Wednesday May 04, 2022 @04:56AM (#31258172)
Maybe normal text editors should support the separators.
Re:Why isn’t there a decent file format for tabular data? by alpaca128 on Wednesday May 04, 2022 @05:40AM (#31258386)
That and the fact that the comma (or semicolon, as I prefer it due to the rare usage) is on every keyboard.

A text editor can be made to handle those separators, but editing or processing the file can be more cumbersome than csv and tsv.

Re:Why isn’t there a decent file format for tabular data? by atoav on Wednesday May 04, 2022 @03:10AM (#31257623)
I guess if you use an strange character nobody has on their keyboard, you could also just make it a binary format for efficiency
Re:Why isn’t there a decent file format for tabular data? by Brometheus on Wednesday May 04, 2022 @03:27AM (#31257716)
See my sibling comment.
Re:Why isn’t there a decent file format for tabular data? by thatjoeoverthr on Wednesday May 04, 2022 @03:25AM (#31257702)
It’s a very meta-level problem. The main problem with CSV is “this is CSV” is an ambiguous statement. One could commit to a rule set, and give it a new name. Probably, someone has done this already.
Re:Why isn’t there a decent file format for tabular data? by gregw2 on Wednesday May 04, 2022 @05:00AM (#31258192)
This is why you say RFC 4810 CSV
Re:Why isn’t there a decent file format for tabular data? by _Algernon_ on Wednesday May 04, 2022 @03:38AM (#31257775)
Sounds like xkcd 927
Re:Why isn’t there a decent file format for tabular data? by mmis1000 on Wednesday May 04, 2022 @03:29AM (#31257722)
works on telnet natively if data is always shorter than 8 character, i think.

tab on terminal actually means to "indent to next align point (which is usually multiple of 8)

Re:Why isn’t there a decent file format for tabular data? by clarkevans on Tuesday May 03, 2022 @11:24PM (#31256401)
The DBT (DBase III) format was common in the 80s and 90s. It is a typed, fixed-width format that was directly supported by Excel, Visual Basic grid widgets, among many other tools. For example, Norton Commander supported it directly, letting you preview database tables without loading another program.
Re:Why isn’t there a decent file format for tabular data? by zzo38computer on Wednesday May 04, 2022 @01:31AM (#31257061)
Do you have the file format documentation?
Re:Why isn’t there a decent file format for tabular data? by pmontra on Wednesday May 04, 2022 @01:58AM (#31257180)
Re:Why isn’t there a decent file format for tabular data? by vram22 on Wednesday May 04, 2022 @03:55AM (#31257856)
>The DBT (DBase III) format was common in the 80s and 90s.

That should actually be DBF, the format for the main database tables. DBT was an ancillary format for the memo fields, which were used to store longer pieces of text in one column of a DBF record. Overall, that generic format and associated software is called XBASE. People still use it in production. And data entry (CRUD) using it with plain text or TUI DOS-style apps blows Web and even GUI apps out of the water in speed of use.

Re:Why isn’t there a decent file format for tabular data? by zzo38computer on Tuesday May 03, 2022 @09:36PM (#31255829)
The latest version of SQLite has a STRICT command to enforce the data types. This option is set per table, but even in a STRICT table you can specify the type of some columns as ANY if you want to allow any type of data in that column (this is not the same meaning of ANY in non-strict tables).
Re:Why isn’t there a decent file format for tabular data? by briHass on Tuesday May 03, 2022 @10:29PM (#31256093)
You are limited to the basic types (int, floating point, string, and blob), however. I can somewhat get behind the opinionated argument for not needing more specific types like most common language types, but not the lack of a date type.
Re:Why isn’t there a decent file format for tabular data? by leeoniya on Tuesday May 03, 2022 @10:37PM (#31256137)
> but not the lack of a date type.

i've also found this to be truly bizarre. even more bizarre than not actually respecting (via coercing or error) to the specified type...why even have types, then?

Re:Why isn’t there a decent file format for tabular data? by zoomablemind on Tuesday May 03, 2022 @11:20PM (#31256384)
What's so special about having a named type for datetime? User will still need to call functions to manipulate the dates. If only for the default display and import?
Re:Why isn’t there a decent file format for tabular data? by pmontra on Wednesday May 04, 2022 @02:02AM (#31257194)
I've seen a sqlite database with datetimes in three different formats in the same field, because different parts of the application I inherited had different ideas of how to write a datetime and sqlite accepts everything. It's only a string after all.

That's a mistake that the same bad developer couldn't have done with a PostgreSQL or a MySQL.

Re:Why isn’t there a decent file format for tabular data? by zoomablemind on Wednesday May 04, 2022 @05:25AM (#31258325)
I understand that SQLite can store datetime in REAL type no problems, just on import one needs to convert the date strings properly. Of course, stuffing strings verbatim may work too, but that's about the robustness of the load process or the ETL pipeline.
Re:Why isn’t there a decent file format for tabular data? by PeterisP on Wednesday May 04, 2022 @12:28AM (#31256765)
For dates, having a specific date type instead of a text field is required to have proper behavior when sorting and efficient storage/data transfer.

It's also important to have date-related functions on the DB server side, so that you can use them in filtering data before it gets sent over to the user code running on the client, to avoid unnecessary data transfer and allow proper use of indexes in optimizing it.

Also, it is nice if a DB engine can perform the equivalent of `WHERE year(date)=2021` without actually running that function on every date, but rather automatically optimize it to an index lookup of `WHERE date between '2021-01-01' and '2021-12-31'`.

Re:Why isn’t there a decent file format for tabular data? by zoomablemind on Wednesday May 04, 2022 @09:53AM (#31260416)
> ...`WHERE year(date)=2021` without actually running that function on every date, but rather automatically optimize it to an index lookup of `WHERE date between '2021-01-01' and '2021-12-31'`

Sure this would be handy. Are there engines that implement such optimization?

I can also see how the 'dated' WHERE clause could be used directly in SQLite to leverage the index. Of course, using year() is more expressive. It may also make sense in such a case to simply add a year column and have it indexed.

Re:Why isn’t there a decent file format for tabular data? by GekkePrutser on Wednesday May 04, 2022 @07:38AM (#31259110)
Having a standardised format for data from different sources. If there's no standard people will use their OS specific format. That makes it harder to compare datasets from different sources
Re:Why isn’t there a decent file format for tabular data? by yawaramin on Tuesday May 03, 2022 @11:23PM (#31256400)
In the context of this thread–a decent file format for tabular data–SQLite's type system peculiarities are irrelevant.
Re:Why isn’t there a decent file format for tabular data? by mavhc on Wednesday May 04, 2022 @05:15AM (#31258269)
Got to pick a date format first, what date it is depends on what calendar you use, and where you are in the world. That's before you add time.

So you could base it on UT1/TAI, but then that ignores clocks in space.

Re:Why isn’t there a decent file format for tabular data? by SkyPuncher on Wednesday May 04, 2022 @12:05AM (#31256622)
Most csv utilities support an alternative delimiter. If I need to edit a file by hand, I'll typically pick an uncommon character for the delimiter (pipe "|" works well since it's uncommon). For me, that pretty much entirely eliminates any of the pain with CSV.
Re:Why isn’t there a decent file format for tabular data? by fiddlerwoaroof on Wednesday May 04, 2022 @02:11AM (#31257248)
More tools should use the ASCII unit and field separator characters intended for this purpose: https://ronaldduncan.wordpress.com/2009/10/31/text-file-form...
Re:Why isn’t there a decent file format for tabular data? by cylinder714 on Thursday May 12, 2022 @10:25AM (#31354692)
See also Control Character Separated Values: https://www.ccsv.io/
Re:Why isn’t there a decent file format for tabular data? by mro_name on Wednesday May 04, 2022 @03:04AM (#31257578)
wow, the solution hides in clear sight right before our eyes. Once again.
Re:Why isn’t there a decent file format for tabular data? by vim-guru on Thursday May 12, 2022 @07:34AM (#31352455)
This is gold
Re:Why isn’t there a decent file format for tabular data? by riffraff on Wednesday May 04, 2022 @12:24AM (#31256746)
tab-separated-value has never betrayed me! I think it's the default postgresql file export too.
Re:Why isn’t there a decent file format for tabular data? by atoav on Wednesday May 04, 2022 @03:12AM (#31257635)
As long as the fields are quoted and escaped : )
Re:Why isn’t there a decent file format for tabular data? by lumost on Wednesday May 04, 2022 @12:09AM (#31256647)
I've often wondered what would happen if there was a standard text editor plugin for dealing with parquet and co.

It seems like these formats are disliked, as they are difficult to inspect - but there really isn't any reason UTF-8 bytes arranged in a large sequence (aka CSV) should be any easier to read except for editor support. Sure writes would be slower, but I'd expect most users wouldn't care on modern hardware.

Re:Why isn’t there a decent file format for tabular data? by sanderjd on Wednesday May 04, 2022 @12:38AM (#31256814)
Yeah I don't really understand the downside to a format like parquet here. "Less ubiquitous" seems to be the only one in the parent comment's list?
Re:Why isn’t there a decent file format for tabular data? by zzo38computer on Wednesday May 04, 2022 @01:43AM (#31257107)
I suppose that another possible format is PostScript format, which has some of its own advantages and disadvantages. It has both text and binary format, and the binary object sequence format can easily be read by a C code (I wrote a set of macros to do so) without needing to parse the entire structure into memory at first; just read the element that you need, alone, one at a time, in any order. (I have used this format in some of my own software.)

JSON also has its own advantages and disadvantages.

Of course, both of these formats are more structured than CSV, but XML is also a more structured format.

(And, like I and others have mentioned too, the format that they dsecribed isn't actually unique; it just doesn't seem to be that common, but there are enough people who had done the same thing independently, and a few programs which support it, that you could use it if you want to do, and it should work OK.)

Re:Why isn’t there a decent file format for tabular data? by omegalulw on Wednesday May 04, 2022 @02:22AM (#31257327)
One thing of note is that there isn't a single format that's optimal for storing tabular data - what's optimal depends on your use case. And if performance doesn't matter much, just use CSV.

As a simple example, column based formats can significantly speed up queries that don't access the full set of columns. They can come in handy for analysis type SQL queries against a big lump of exported data - where different users query the subset they are interested it.

Re:Why isn’t there a decent file format for tabular data? by mftb on Wednesday May 04, 2022 @03:08AM (#31257605)
As best I can tell no one has mentioned Recutils[0]?

It is a little bizarre that csv has never really been nailed down, but yea it's all about trade-offs.

[0]https://www.gnu.org/software/recutils/

Re:Why isn’t there a decent file format for tabular data? by mftb on Wednesday May 04, 2022 @01:56PM (#31263726)
Replying to myself, because after reviewing other comments I realized I didn't read the linked post thoroughly enough. Near the end he proposes a format called "usv", basically using the control codes (unit separator \u001f and record separator \u001e) built into ASCII and now Unicode for their intended purpose, which is actually a really good idea! Apparently this had been noted earlier as a format called "adt"[0].

[0]https://ronaldduncan.wordpress.com/2009/10/31/text-file-form...

Re:Why isn’t there a decent file format for tabular data? by bezospen15 on Tuesday May 03, 2022 @10:40PM (#31256149)
Ther are tons of billion dollar companies that have entire systems utilizing csv and xlsx tubular data for mission critical processes lol
Re:Why isn’t there a decent file format for tabular data? by dukoid on Wednesday May 04, 2022 @05:50AM (#31258428)
Surprised that nobody has mentioned ARFF: https://www.cs.waikato.ac.nz/ml/weka/arff.html
Re:Why isn’t there a decent file format for tabular data? by bryanrasmussen on Wednesday May 04, 2022 @02:08AM (#31257228)
>xml -- Useful if you are programming in early 2000s

I guess nobody knows about document formats anymore.

Re:Why isn’t there a decent file format for tabular data? by zo1 on Wednesday May 04, 2022 @02:18AM (#31257292)
They are re learning those lessons slowly. I.e. OpenAPI and json schema are pretty much poor re implementations of SOAP and XSD but for json. I don't want to be that get off my lawn guy but it's laughable how equivalent they are for 99% of daily use cases.
Re:Why isn’t there a decent file format for tabular data? by petepete on Wednesday May 04, 2022 @05:42AM (#31258398)
Every time I hear someone talking about validating JSON I just think about how, despite its flaws, XSD is actually pretty decent despite being 20 years old.
Re:Why isn’t there a decent file format for tabular data? by bryanrasmussen on Wednesday May 04, 2022 @10:56AM (#31261366)
The first time I used XSD was in 2001 I think, for a format we were developing to do human rights violation reporting.

In one part of the document would be a list of people committing violations, another part a list of people witnessing violations, and then in another part violations.

The violations part would have attributes saying what people had taken part in the violation, and who had witnessed. These attributes were a comma separated list of ids.

This structure is of course easy to represent with XPath, probably via Schematron. But there is no real way to represent this kind of context dependent structure in the first version of XSD (I have not kept up for reasons that shall become clear).

Which led me to declare that XSD sucks. Although I have to admit that Henry Thompson is a great programmer, and one of the most worthwhile speakers on technical issues I have ever had the pleasure to here, and while his model of XSD validation as a finite state machine is also elegant it still does not make it suck any less because the standard could not validate many common markup structures.

Re:Why isn’t there a decent file format for tabular data? by petepete on Wednesday May 04, 2022 @02:48PM (#31264326)
Yeah I also hit the XSD complexity ceiling on occasion. Most of what we used it for back in the early-mid 00s was quite simple though and it did make much of our work simpler.
Re:Why isn’t there a decent file format for tabular data? by bryanrasmussen on Wednesday May 04, 2022 @04:39PM (#31265547)
That XSD is complex is one thing, some things are by their nature complex, ok, that it was not able to validate common XML structures was another thing, a third thing was cross validation tool support sucked.

Actually this combination of difficulties actually made it sort of enjoyable for me to solve problems stemming from it's usage, and looking smart for doing so, while still feeling like I was using a deficient tool.

Re:Why isn’t there a decent file format for tabular data? by GekkePrutser on Wednesday May 04, 2022 @07:42AM (#31259147)
XML and its associated formats were just so complex. I remember considering getting a book on XML and it was 4 inches thick. Just for a text-based data storage format...

This is just prohibitively complex. Formats like JSON and YAML thrive because they don't have the complexity of trying to fit every possible scenario ever. The KISS principle still works.

Re:Why isn’t there a decent file format for tabular data? by bryanrasmussen on Wednesday May 04, 2022 @04:49PM (#31265679)
Several things though -

1. tech books tend to be too big

2. These XML books tended to have section on XML and well formedness, namespaces, UTF-8, examples of designing a format - generally a book or address format - all this stuff probably came in to approximately 80-115 pages. Which was what you needed to understand the basis of XML.

3. Then would come the secondary stuff to understand, XPath and XSLT. I would say this would be another 100 - 150 pages, so a query language and a programming DSL to manipulating the data/document format. All this together 265 pages.

4. Then validation and entities in DTDs noting that this was old stuff from SGML days and you didn't need it and there was going to be some other way to validate really soon. Another 60 pages? (and then when that validation language came it sucked, as I noted elsewhere)

5. Then because tech books need to be thick and a 300 page book is not big enough a bunch of stuff that never amounted to anything, like Xlink or some breathless stuff about some XML formats, maybe a talk about SVG and VML, XSL-FO blah blah blah. Another 300 pages of unnecessary stuff.

Re:Why isn’t there a decent file format for tabular data? by Banana699 on Tuesday May 03, 2022 @11:45PM (#31256505)
The author doesn't like any of those tradeoffs and wishes to make another one, what's the problem with that ?

You don't believe the design space is exhaustively explored by the designs and protocols you mentioned, do you? there is always another local optimum to be found.

Re:Why isn’t there a decent file format for tabular data? by jonas21 on Wednesday May 04, 2022 @12:24AM (#31256741)
The problem is that the author states that none of these existing formats are "decent" and falls back on shallow dismissals like "Don’t even get me started on Excel’s proprietary, ghastly binary format."
Re:Why isn’t there a decent file format for tabular data? by jayd16 on Tuesday May 03, 2022 @10:21PM (#31256054)
None of them seem all that conducive to source control or merging. Any good format for that?
Re:Why isn’t there a decent file format for tabular data? by civilized on Tuesday May 03, 2022 @10:59PM (#31256260)
Why would we expect data to be amenable to version control systems designed for source code?
Re:Why isn’t there a decent file format for tabular data? by jayd16 on Wednesday May 04, 2022 @11:35AM (#31261947)
I don't _expect_ it but I want it. Surely you can understand the power of storing a config file as tabular data.
Re:Why isn’t there a decent file format for tabular data? by AdrenalinMd on Wednesday May 04, 2022 @04:21AM (#31258001)
There is a git diff driver for CSV that makes the CSV diffing and merging a lot better. https://paulfitz.github.io/2014/07/09/diff-merge-csv.html

Works like a charm!

Re:Why isn’t there a decent file format for tabular data? by jayd16 on Thursday May 05, 2022 @12:28PM (#31275399)
Looks good, although I don't think I would want the diffs to be in cell. I might just end up writing my own merge tool that passes conflicting cells to a fallback tool.
Re:Why isn’t there a decent file format for tabular data? by wtetzner on Tuesday May 03, 2022 @10:29PM (#31256092)
CSV should be pretty easy to merge, given that it’s line based.
Re:Why isn’t there a decent file format for tabular data? by jayd16 on Wednesday May 04, 2022 @11:33AM (#31261923)
Although it's the easiest, same row cell changes still conflict unnecessarily.
Re:Why isn’t there a decent file format for tabular data? by wtetzner on Sunday May 15, 2022 @06:54PM (#31391957)
Interestingly, tables in XML would be easy to merge, as long as they're formatted with one cell per line. E.g.

    <table>
      <row>
        <cell>1</cell>
        <cell>45</cell>
      </row>
    </table>
Re:Why isn’t there a decent file format for tabular data? by themadturk on Tuesday May 03, 2022 @11:37PM (#31256468)
We use Subversion to manage CSV files pretty much constantly.
Re:Why isn’t there a decent file format for tabular data? by tantalor on Tuesday May 03, 2022 @10:27PM (#31256078)
Don't put data in source control; use a database.
Re:Why isn’t there a decent file format for tabular data? by nvader on Tuesday May 03, 2022 @10:30PM (#31256097)
Laughs in Lisp

Code is Data would like to have a word

Re:Why isn’t there a decent file format for tabular data? by civilized on Tuesday May 03, 2022 @10:58PM (#31256250)
Code may be data but data isn't code.
Re:Why isn’t there a decent file format for tabular data? by Banana699 on Tuesday May 03, 2022 @11:49PM (#31256528)
Data is code that prints/evaluates to itself.
Re:Why isn’t there a decent file format for tabular data? by zzo38computer on Wednesday May 04, 2022 @01:33AM (#31257068)
In some programming languages (such as PostScript, where evaluating as itself vs being executed, is a flag separate from the value's type, and can be changed by the cvlit and cvx operators), it is.
Re:Why isn’t there a decent file format for tabular data? by civilized on Wednesday May 04, 2022 @09:21AM (#31259990)
The higher-ups might be unhappy if you use that excuse after committing a gigabyte of customer data.
Re:Why isn’t there a decent file format for tabular data? by uuyi on Wednesday May 04, 2022 @02:44AM (#31257453)
Executable data was never a good idea.
Re:Why isn’t there a decent file format for tabular data? by Tostino on Wednesday May 04, 2022 @08:25AM (#31259486)
What if you are doing both, as in trying to source control your database. A lot of tools (liquibase for one) can use CSV files as the basis of read-mostly lookup tables for example. E.g. if I had a list of "product categories" that I wanted to be part of my database when I bootstrap a new environment to run my software. Liquibase can turn that CSV file into a set of upserts that will run if the file hash has changed. So you can maintain that file with just regular edit file > git commit, and it will ensure that table is always consistent with what you want and gives you a much easier to understand commit history for your database, especially as things inevitably get complicated.
Re:Why isn’t there a decent file format for tabular data? by rawgabbit on Wednesday May 04, 2022 @10:38AM (#31261079)
Databases are measured in gigabytes and terabytes. If you put only a portion of it in source control, how do you back up the rest of your database? Furthermore, static data is a minor subset of a database. Data by its nature is volatile. Transactions make up 80% of the data. A projection or snapshot/summary is a the summarization of the daily/hourly/minute transactions. If you want a golden copy to bootstrap new environments, I would argue you are better off backing up that golden copy and restoring it using native database tools. Mashing together two very different paradigms will lead to long term disaster. There was a thread about a year ago, when a DevOps engineer was surprised when his "nonproduction" configuration code deleted his production database. If your database is a terabyte in size, by the time you restore the database -- you are already fired.
Re:Why isn’t there a decent file format for tabular data? by Tostino on Friday May 13, 2022 @12:24PM (#31369574)
I am way late responding...

> If you put only a portion of it in source control, how do you back up the rest of your database? I think this is simply a misunderstanding of how these DB change management tools work and what they can do to help you with complex migrations over an applications lifetime.

You still back your DB up like normal.

Your your "mostly static" data is managed by running inserts/updates/deletes when data changes (either manually, or the tool can usually generate them for you), when you actually apply it, the software also records that the migration has been applied in a database change log table. That way when you want to update your database with the latest migrations, it'll only run what hasn't been applied yet.

That allows your standard backup/restore procedures to work just fine.

> If you want a golden copy to bootstrap new environments, I would argue you are better off backing up that golden copy and restoring it using native database tools

So this is essentially what we are doing with liquibase... Using database dumps without any data as our baseline.

Any DDL changes are managed through migration scripts.

There are a number of things that are not managed by migration script, and are instead apply-on-change in our project though.

We found it better to have our views stored as individual files in liquibase, and have them apply on change, because of nested dependencies and other issues with not having a good source of truth for the view definition.

Functions/procedures were another that are best treated as code rather than migrations. It allows you to deal with conflicts between branches with your standard merge tools.

Our "static" data that would only change when there is an application change is managed through csv files managed by liquibase that apply on any change. That needs to be in-sync with the version of the application deployed, so it makes sense to manage that along with the code.

Re:Why isn’t there a decent file format for tabular data? by jayd16 on Wednesday May 04, 2022 @11:36AM (#31261970)
I could use a SQLite file for tabular data/configs but that would still not support merging.
Re:Why isn’t there a decent file format for tabular data? by kimi on Wednesday May 04, 2022 @12:42AM (#31256839)
And put that under source control.
Re:Why isn’t there a decent file format for tabular data? by hdjjhhvvhga on Wednesday May 04, 2022 @06:47AM (#31258728)
> GDBM, Kyoto Cabinet, etc -- Useful if you are programming in late 1990s

Hold your horses:

https://charlesleifer.com/blog/completely-un-scientific-benc...

While I would never consider GDBM for any new project, I wouldn't dismiss its performance for small/locally accessed data stores.

Re:Why isn’t there a decent file format for tabular data? by jillesvangurp on Wednesday May 04, 2022 @12:12AM (#31256664)
ndjson is actually a really pragmatic choice here that should not be overlooked.

Tabular formats break down when the data stops being tabular. This comes up a lot. People love spread sheets as editing tools but they then end up doing things like putting comma separated values in a cell. I've also seen business people use empty cells to indicate hierarchical 'inheritance". An alternate interpretation of that is that that data has some kind of hierarchy and isn't really row based. People just shoehorn all sorts of stuff into spreadsheets because they are there.

With ndjson, every line is a json object. Every cell is a named field. If you need multiple values, you can use arrays for the fields. Json has actual types (int, float, strings, boolean). So you can have both hierarchical and multivalued data in a row. The case where all the fields are simple primitives is just the simple case. It has an actual specification too: https://github.com/ndjson/ndjson-spec. I like it because I can stream process it and represent arbitrarily complex objects/documents instead of having to flatten it into columns. The parsing overhead makes it more expensive to use than tsv though. The file size is fine if you use e.g. gzip compression. It compresses really well generally.

But I also use tab separated values quite often for simpler data. I mainly like it because google spread sheets provides that as an export option and is actually a great editor for tabular data that I can just give to non technical people.

Both file formats can be easily manipulated with command line tools (jq, csvkit, sed, etc.). Both can be processed using mature parsers in a wide range of languages. If you really want, you can edit them with simple text editors, though you probably should be careful with that. Tools like bat know how to format and highlight these files as well. Etc. Tools like that are important because you can use them and script them together rather than reinventing wheels.

Formats like parquet are cumbersome mainly because none of the tools I mention support it. No editors. Not a lot of command line tools. No formatting tools. If you want to inspect the data, you pretty much have to write a program to do it. I guess this would be fixable but people seem to be not really interested in doing that work. Parquet becomes nice when you need to process data at scale and in any case use a lot of specialized tooling and infrastructure. Not for everyone in other words.

Character encoding is not an issue with either tsv or ndjson if you simply use UTF-8, always. I see no good technical reason why you should use anything else. Anything else should be treated as a bug or legacy. Of course a lot of data has encoding issues regardless. Shit in, shit out basically. Fix it at the source, if you can.

The last point is actually key because all of the issues with e.g. csv usually start with people just using really crappy tools to produce source data. Switching to a different file format won't fix these issues since you still deal with the same crappy tools that of course do not support this file format. Anything else you could just fix to not suck to begin with. And if you do, it stops being an issue. The problem is when you can't.

Nothing wrong with tsv if you use UTF-8 and a some nice framework that generates properly escaped values and does all the right things. The worst you can say about it is that there are a bit too many choices here and people tend to improvise their own crappy data generation tools with escaping bugs and other issues. Most of the pain is self inflicted. The reason csv/tsv are popular is that you don't need a lot of frameworks / tools. But of course the flipside is that DYI leads to people introducing all sorts of unnecessary issues. Try not to do that.