Say you wanted a database inside a huge distributed JSON file that scaled vertically.

So that get("users.jane33"), pulls Jane33’s profile.

Are there any specs for that? I’ve seen MongoDB, but no longer like its license.

I’m thinking a DHT with pointers, and raw data blobs. But would like to see what’s already working.

      • expr ( expr@programming.dev ) 
        link
        fedilink
        arrow-up
        3
        ·
        1 hour ago

        You do realize that a RDBMS is a system for managing flat files, right? They all store their contents in various files on disk.

        I am highly suspicious that you’ve actually encountered database corruption with an RDBMS. That’s incredibly unlikely as they are purposefully designed to be extremely fault tolerant (much more fault tolerant than whatever you would come up with yourself).

        What you are talking about is reinventing a bad RDBMS. JSON is a textual format for human consumption, not one that is at all fit for efficient data storage and access.

      • farcaller ( farcaller@fstab.sh ) 
        link
        fedilink
        arrow-up
        13
        ·
        8 hours ago

        duckdb can read raw json files, if that’s your cup of tea. Querying with SQL has nothing to do with the underlying storage format. If your storage is immutable, it can’t be corrupted by writes to begin with, and duckdb couldn’t care less. It can work even over http, with your static json served over S3 if that’s your cup of tea.

        I’d suggest you figure the data storage separate from querying and see what requrements you have for both.

        • ki4jgt ( ki4jgt@feddit.org ) OP
          link
          fedilink
          arrow-up
          1
          ·
          8 hours ago

          I’ve edited my comment. I’ve seen too many database corruptions with SQL. I prefer a memcached flat file database. I usually roll them by hand, but I’m getting older.

          • Azzu ( Azzu@leminal.space ) 
            link
            fedilink
            arrow-up
            16
            ·
            edit-2
            7 hours ago

            A database like PostgreSQL probably corrupts less often than plain files. And your statement doesn’t even make sense, as theoretically, you can also query plain files with SQL, SQL after all is just a query language, not a storage system.

            You’re probably trying to get away from a specific system that uses SQL, but getting away from SQL itself doesn’t make sense in that context.

            • ki4jgt ( ki4jgt@feddit.org ) OP
              link
              fedilink
              arrow-up
              1
              ·
              7 hours ago

              But the storage systems often reflect an entire underlying ideology on how data should be stored. I’ve seen so many DBs carrying SQL corrupt and require hours of work to fix, that I’m done with the entire concept.

              Then there’s the ideology that I shouldn’t have to learn an entirely separate language, just to query a database.

              My DBs tend to focus on distributed hashing algorithms. If the data becomes corrupted, it can be copied via the hash, from a different shard. It fixes so many problems. I’ll admit it’s a feeling, but I just don’t like using systems where I don’t understand the underlying architecture. And most SQLs make absolutely no sense to me, except attempting to make things compact (to save disk space, which is what causes most corruptions in the first place).

              One variable, completely unrelated to anything, corrupts everything, because SQL databases prefer compaction over flat file storage.

              • Azzu ( Azzu@leminal.space ) 
                link
                fedilink
                arrow-up
                16
                ·
                7 hours ago

                Most of what you said conceptually is just simply false. Your experiences are of course valid, though I think you’re drawing the wrong conclusions.

              • What are you even doing? I’ve been running db’s as part of apps my entire life, including being staff engineer for a team responsible for petabytes of data and databricks and I’ve never heard or had any of this happen.

                • ki4jgt ( ki4jgt@feddit.org ) OP
                  link
                  fedilink
                  arrow-up
                  1
                  ·
                  7 hours ago

                  https://lmgtfy.com/?q=SQL+database+corruption+before%3A2018

                  I’ve had so many corruptions from SQL related databases, with software that wasn’t even my own. My latest problem with it is the Briar Project. Try it out. Spend a month in one of the online forums, and your entire identity is lost due to an SQL database corruption. You lose your entire identity within the network.

                  I don’t know where you’ve been, but if you haven’t experienced a database corruption with SQL, you’re either not that high up, or your company isn’t that large.

    • ki4jgt ( ki4jgt@feddit.org ) OP
      link
      fedilink
      arrow-up
      1
      ·
      7 hours ago

      Why would one want to learn an entirely separate language, just to query their database? get("users.Jane33") is far superior. It stays in the language you’re using. You don’t have to develop your own library to interact with your database, which is an entire abstraction layer. And you’re pulling exactly what you need, especially if the data is hash addressed. You’re not sorting through hundreds of records to find the one that matches what you want, and supplying a masking pattern to weed out everything else.

      SQL has been a pain in the @$$ for development for years. It’s a bad design. Has been for a very long time.

      • wet_bones ( wet_bones@lemmy.4d2.org ) 
        link
        fedilink
        English
        arrow-up
        4
        ·
        7 hours ago

        MongoDB also has its own query language and works on JSON documents. The syntax you’ve got is similar to most languages’ dict addressing. The problem you’ll have in Python though is running into memory limits pretty quickly.

        I’m unsure if your ultimate goal but I encourage you to build something awesome with all this energy and ideas!

  • TehPers ( TehPers@beehaw.org ) 
    link
    fedilink
    English
    arrow-up
    1
    ·
    6 hours ago

    Maybe a different kind of solution to what you’re looking for, but JSON-LD does this in a distributed (multi-system) manner. Maybe a little more distributed than you want, though.

    Essentially, you can use IRIs (and IRI references) to point to specific objects/subtrees. The thing is, IRIs are usually dereferenceable as URLs that point to the object’s value, so you’d use a HTTP client to fetch it in order to dereference the data.

    It’s used by Lemmy of course (and ActivityPub in general), and it’s mostly designed when you have different people publishing JSON documents that want to link to each other.


    More along the lines of what you’re probably looking for is any NoSQL document database. You want to be able to set an index within the document that the database can use for fast lookups. There’s a ton out there, so not much point listing them here when you can find lists online very easily.

    Personally, I’d rather just use a SQL database for this though. To begin with, you wouldn’t design your database to be a single, large, ever-growing JSON document, but rather several JSON documents (one per “object” being stored, like one per user). This allows your distributed database to split the load on requests coming in via sharding as well as help it quickly find what you’re looking for (assuming your query is on an indexed key). SQL databases let you better structure the data you actually intend to query on (IDs, names, whatever), and you can put whatever other attached data you want as a JSON field (Postgres JSONB for example).