3 ms·
As someone who does indie ruby stuff, often under time constraints, I find jsonb great for storing messy data that looks unnecessary, but which might be useful
by nomilk 5y ago
As someone who does indie ruby stuff, often under time constraints, I find jsonb great for storing messy data that looks unnecessary, but which might be useful down the track. jsonb is just another type as far as postgres/rails is concerned, so it's fast implement (just like any other rails migration), fast to query, and easy to access using key/value (similar to the ruby hash).
- jrochkind1 5y agoIf you are using Rails and jsonb, you may be interested in https://github.com/jrochkind/attr_json https://github.com/jrochkind/attr_json (by myself), or https://github.com/madeintandem/jsonb_accessor https://github.com/madeintandem/jsonb_accessor (an alternative).
- bullfightonmars 5y agoWe wrote a similar library that hooks into ActiveRecord. https://github.com/data-axle/superstore https://github.com/data-axle/superstore
- jrochkind1 5y agoInteresting, thanks, I hadn't seen this one before! So many of us inventing the same wheel! The docs on yours are kind of limited, I don't really understand how it maps to your postgres tables, what schema it's expecting. But I plan to find time to check it out just to compare and contrast with mine! Thanks!
- bullfightonmars 5y agoYeah. We built this for our own use and haven’t really documented it extensively. We use it in conjunction with an elastic search ORM. https://github.com/data-axle/elastic_record https://github.com/data-axle/elastic_record
- jrochkind1 5y agoAgain, interesting, thanks! I hadn't seen that ElasticSearch ORM either! The more popular one of course is: https://github.com/elastic/elasticsearch-rails https://github.com/elastic/elasticsearch-rails It can be hard to know what open source is out there!
- paulryanrogers 5y agoFor speculative storage like that my preference is for files, ideally on something like S3. It's harder to analyze but IME the need is infrequent. Storage is usually significantly cheaper than a DB.