1 month ago 🥁 for day 245, 2021 with 222 words.

JSON

Exercise: Walk to Wal-Mart
Piano Song of the day: Let It Go (161 / 182)


Yes, I'm playing songs from Frozen, reasonably well considering that it's a bit of a dirge. Why, well it's Disney week on my Piano App and I thought I'd give it a go. Hopefully, we'll get to some of the more well know classic Disney songs (from my youth).


I've been playing with the JSON commands in MySQL, and I'm really beginning to wonder if they could have made it uglier if they tried. MySQL is a relational database and was never really designed to store JSON data. Then MongoDB came along and everything in MongoDB is JSON and it has a sweet syntax of accessing and updating the contents of fields.

MySQL does not.

Sure MySQL has things like column->"$.field.subfield" to fetch a sub-field nested in a JSON structure and you can even say things like column->"$.*.foo" but it isn't actually that useful in practice.

The thing is that its is OK for getting data, but you want to use the same syntax for setting data, eg:

column->"$.field.subfield" = 42;

But no you can't do that, that would be too easy and consistent, no you need to do:

column = JSON_SET(column, "$.field.subfield", 42)

Ugh.

dreamer

Start writing today, for free

Write Together is a safe space to blog, think, feel, and share together. Learn to write, or find a new home for your words, and join our passionate community.

Sign up Learn more
User Photo

By Yorick Phoenix 🥁

Chief WriteTogether Bug Finder & character stringer. Generally, to create computer code, but sometimes actual words and paragraphs. Listens to lots of music, takes lots of photos, & invests in stocks for the long haul.

Get Yorick Phoenix's newsletter

Almost there! Check your inbox and click the link to confirm.

Subscribe to Yorick Phoenix's latest writing to get it right in your inbox.