I don't want to be a WTF!



  • I've got an idea for an upcoming project, but it seems close enough to some of the constructs I've seen front-paged here that I want to make sure it won't make an appearance. Basically, I have two servers (Jade and Lapis). Jade is an internal server, which every night generates about 10M of data in tabular form and sends it to Lapis. Lapis is a publicly viewable web server, which displays the data. Every table is keyed with a unique integer.

    Now for the possible WTF. For storing the data, I'm thinking about just putting it into a MySQL database. This would entail a schema looking like this:

        CREATE TABLE stored_data (id INTEGER PRIMARY KEY, data TEXT);

    with "data" looking something like this:

        "[[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]]"

     

    Although it seems to solve the problem, the idea of encoding a relation into text, to be stored in a tuple of another relation, seems silly. Thoughts?
     



  • I do not think that you desire a relational database, so it puzzles me as to why you are thinking about using one. If there is genuinely no reason for it, as there appears not to be, then it would be a WTF.

    It's hard to guess without knowing what you're really doing, but this smells like an attempt to simulate a flat file using a relational database. That's just nuts.



  • Why don't you store WHOLE tabular data coming from Jade in Mysql and serve as needed? I see it so: Jade generates the data, Insets it into MySQL in Lapis, and Lapis takes care of the presentation? Nice, clean and pornfree...



  • Go Back. Back to before the data becomes "text "[1,2,3,4],[5,6,7,8]" " Then you will find data in a nice, not WTFery way. Store that.

     If not, then parse that text back into the nice integers and store them. A table with 5 array(int)[4]s perhaps. It does depend on what those numbers represent, and how they are used.
     



  • This MIGHT be a decent solution if you passed the brackets unprocessed over the wire to some AJAX front end (JSON). But if you plan to parse them on the server side again, I agree with all the other posters, that's definitely a WTF.



  • @asuffield said:

    I do not think that you desire a relational database, so it puzzles me as to why you are thinking about using one. If there is genuinely no reason for it, as there appears not to be, then it would be a WTF.

    It's hard to guess without knowing what you're really doing, but this smells like an attempt to simulate a flat file using a relational database. That's just nuts.

    The MySQL database is already being used to drive the rest of the website, so it seemed reasonable to store the data there. The alternative was to create a directory somewhere containing thousands of files named 1.dat, 2.dat, etc, and then 1) query the database to find what file to open and 2) open the file.

    @death said:

    Why don't you store WHOLE tabular data coming from
    Jade in Mysql and serve as needed? I see it so: Jade generates the
    data, Insets it into MySQL in Lapis, and Lapis takes care of the
    presentation? Nice, clean and pornfree...

    The MySQL database is not remotely accessible, and the servers are in two entirely separate locations connected only by the public internet. I'm encrypting the data using GnuPG, and don't know enough about MySQL's encryption to trust it.

    @robbak said:

    Go Back. Back to before the data becomes "text
    "[1,2,3,4],[5,6,7,8]" " Then you will find data in a nice, not WTFery
    way. Store that.

     If not, then parse that text back into the nice
    integers and store them. A table with 5 array(int)[4]s perhaps. It does
    depend on what those numbers represent, and how they are used.

    The bracket encoding is just for transmission between the servers, and because it can be easily parsed by the server. There's no guarantee that the data will all be the same size - there might be cases where it has 20 tuples of 2 values each, or 1 tuple of 200 values. I also don't understand what you mean by "array(int)[4]" - can't MySQL only store single values?


Log in to reply