Live data from Hacker News

Moldova broke our data pipeline

avraam.dev

41–50 of 61 posts

Re: Moldova broke our data pipeline

#41
post #29
post #11

I really don't understand why people think it's a good idea to use csv. In english settings, the comma can be used as 1000-delimiter in large numbers, e.g. 1,000,000 for on million, in German, the comma is used as decimal place, e.g. 1,50€ for 1 euro and 50 cents. And of course, commas can be used free text fields. Given all that, it is just logical to use tsv instead!

I learned to program at 33 or so (in bioinformatics), my first real lesson a couple of days in: "Never ever use csv". I've never used pd.read_csv() without sep="\t". Idk where csv came from, and who thought it was a good idea. It must have been pre-spreadsheet because a tab will put you in the next cell so tabs can simply never be entered into any table by our biologist colleagues. I guess it's also why all our fancy…

Tabs can absolutely be entered into cells in multiple ways but the easiest is just copy paste.

And if it’s tab delimited usually people call them tsvs.

Re: Moldova broke our data pipeline

#43
post #37
post #11

I really don't understand why people think it's a good idea to use csv. In english settings, the comma can be used as 1000-delimiter in large numbers, e.g. 1,000,000 for on million, in German, the comma is used as decimal place, e.g. 1,50€ for 1 euro and 50 cents. And of course, commas can be used free text fields. Given all that, it is just logical to use tsv instead!

> I really don't understand why people think it's a good idea to use csv. Because it's easy to understand. Non-technical people understand it. There is tremendous value in that, and that it's underspecified with ugly edge cases doesn't change that.

And you get the under reporting of COVID information in the UK as they passed around CSV files with too many rows for the tools they used.

An interchnage format needs to include information showing that you have all the data - e.g. a hash or the number of rows - or JSON/XML/s-expressions having closing symbols to match the start.

Re: Moldova broke our data pipeline

#44
post #31

I'm not sure how "commas inside strings in CSVs can cause bugs" becomes newsworthy, but I guess even the vibecoding generation needs to learn the same old lessons.

A vibecoded article, about a vibecoded solution, to a trivial problem. Not entirely sure what to think of it, tbh.

Re: Moldova broke our data pipeline

#45

RFC 4180 [1] Section 2.6 says: "Fields containing line breaks (CRLF), double quotes, and commas should be enclosed in double-quotes." If the DMS output isn’t quoting fields that contain commas, that’s technically invalid CSV. A small normalization step before COPY (or ensuring the writer emits RFC-compliant CSV in the first place) would make the pipeline robust without renaming countries or changing delimiters. That…

That's the real shame but also the lesson, a perfectly good and specified format, but the apparent simplicity makes everyone ignore the spec and yolo out broken stuff. This is why SQL is "broken", it's powerful, simple and people will always do the wrong thing. Was teaching a class on SQL, half my class was reminding them that examples with concatenating strings was bad and they should use prepared statements (JDBC).…

I also really like the way Androidx's Room handles query parameters and the corresponding APIs.

    @Dao
    public interface UserDao {
        @Query("SELECT * FROM user")
        List getAll();

        @Query("SELECT * FROM user WHERE uid IN (:userIds)")
        List loadAllByIds(int[] userIds);

        @Query("SELECT * FROM user WHERE first_name LIKE :first AND " +
            "last_name LIKE :last LIMIT 1")
        User findByName(String first, String last);

        @Insert
        void insertAll(User... users);

        @Delete
        void delete(User user);
    }

Re: Moldova broke our data pipeline

#46
post #31

I'm not sure how "commas inside strings in CSVs can cause bugs" becomes newsworthy, but I guess even the vibecoding generation needs to learn the same old lessons.

When they inevitably move to JSON I sure hope nobody's shop includes a quote in the name.

JSON is only written one way, CSV parses all have tweaks for delimiters and column names or not and such.

Re: Moldova broke our data pipeline

#47
post #34

Earlier quoted context omitted.

What's the difference to CSV? number,73786976294838206464

For CSV, I don't know how this comes out. It depends on the library/programming language. It might be 73786976294838210000 or it might throw an exception, or whatever. I'm just saying JSON will not solve your problems neither.

So it always depends on the implementation.

If you need something unambiguously specified, then XML with XSD is still a valid option. All number types are specified exactly, and you can use extensions for custom number types.

Re: Moldova broke our data pipeline

#48
post #44
post #31

I'm not sure how "commas inside strings in CSVs can cause bugs" becomes newsworthy, but I guess even the vibecoding generation needs to learn the same old lessons.

A vibecoded article, about a vibecoded solution, to a trivial problem. Not entirely sure what to think of it, tbh.

Just talked with a colleague and we used this as example where vibe coding is already brain draining people.

Re: Moldova broke our data pipeline

#49
post #25

Unrelated to the fundamental issue (a part of your pipeline generates invalid CSV), I would never store the name of the country like this. The country's name is "The Republic of Moldova" and I would store it like this. Sure, the most common collation scheme for country names is to sort ignoring certain prefixes like "The Republic of", "The", "People's Democratic...", etc. but this is purely a presentation layer issue…

While true, the default and naive sort of anything is alphabetical, and you'd need to implement this more advanced nondefault sort in every possible client.

Personally I've never seen any sort where "The Republic of Moldova" would be sorted at "M".

Re: Moldova broke our data pipeline

#50
post #47

Earlier quoted context omitted.

For CSV, I don't know how this comes out. It depends on the library/programming language. It might be 73786976294838210000 or it might throw an exception, or whatever. I'm just saying JSON will not solve your problems neither.

So it always depends on the implementation. If you need something unambiguously specified, then XML with XSD is still a valid option. All number types are specified exactly, and you can use extensions for custom number types.

what's wrong with protobuf & friends ?
Post reply on HN