Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Half-baked: JSON-to-hyperdb mapping #136

Open
bnewbold opened this issue Jun 11, 2018 · 6 comments
Open

Half-baked: JSON-to-hyperdb mapping #136

bnewbold opened this issue Jun 11, 2018 · 6 comments

Comments

@bnewbold
Copy link
Contributor

Does there already exist a deterministic 1-to-1 mapping between a JSON document and a key/value store like hyperdb? What I mean is taking one (possibly very large) JSON object and splitting it so each "atom" (integer, boolean, string, etc) ends up as a single Value in the database. Eg:

{
  "a": ["red", "blue"],
  "num": 1234,
}

mapping to something like:

/a[]/[0 -> '"red"'
/a[]/1 -> '"blue"'
/num -> '1234'

This could make for a nice high-level API to hyperdb, where applications just get a JSON-like object (whatever that maps to in their native language, eg nested dicts in python). I'm not proposing the opposite (hyperdb-to-JSON), though that might also be a desirable feature, and is trivial in the case of either a single flat JSON object (with full hyperdb paths as keys) or via nested Objects, one per path.

@pfrazee
Copy link
Collaborator

pfrazee commented Jun 11, 2018

👍 I like this idea a lot

@andrewosh
Copy link
Collaborator

andrewosh commented Jun 11, 2018

@bnewbold I'd really like something like this too, especially for large objects where only a subset of the fields change frequently.

I know there are a few things in leveldb-space that tackle this (thinking level-pathwise specifically). Could potentially use hyperdown for a quick 'n dirty prototype with level-pathwise.

@e-e-e
Copy link
Contributor

e-e-e commented Jun 12, 2018

I also like this idea - and think it would be pretty trivial to implement - although does it belong in hyperdb itself or could it be implemented as another module.

@derhuerst
Copy link

FYI I've built something similar: level-tree.

@vsivsi
Copy link

vsivsi commented Jun 25, 2018

This reminds me very much of the functionality of something like Noms. Looks like the company behind that project got sold to Salesforce, but there are interesting ideas (and likely cautionary tales) in there for sure.

@e-e-e
Copy link
Contributor

e-e-e commented Jul 9, 2018

@bnewbold I started playing around with implementing this - https://github.com/e-e-e/hyperdb-json. Its just a quick little POC - but it works for simple cases. I have not implemented deletion or cleanly setting new values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants