At work, we're using sql server, and i stored all json as base64 string though.
0 - https://learn.microsoft.com/en-us/sql/relational-databases/j...
21–30 of 48 posts
At work, we're using sql server, and i stored all json as base64 string though.
0 - https://learn.microsoft.com/en-us/sql/relational-databases/j...
[flagged]
When I read a piece of code I don't understand, ideally I'm able to assume that the author intended what was written, and learn something when I figure out why. With AI generated code, I can't do that: the original author is more or less destroyed once the context is gone; at best I can ask someone who was kinda-sorta around when the author wrote it (i.e. the person who prompted it). At worst I'm really just asking someone (or something) else to guess what was intended.
Even granting that the generated code is implementing a coherent design (and that's a big if!), what we're left with is a very quick way to generate legacy code who's author is no longer around to answer questions. Such legacy code, if it's been proven to work, I might just stick a “don't touch this” sign on it, but if it starts causing any problems, I'd end up doing a ground-up rewrite if only to (potentially) understand what problems and concerns influenced the design to make it what it is.
AI can certainly be useful for this later task, but it'd be far preferable to just start there, as a form of pair-programming. And at that point, I doubt it'd be so interesting to say “built with ‹whatever model is popular today›” in the title.
Earlier quoted context omitted.
Submitted it to The Daily WTF yet?
Why ??
Firstly, SQL server has a built-in JSON type, which lets you query and manipulate the JSON directly: https://learn.microsoft.com/en-us/sql/relational-databases/j...
Secondly, JSON is already serialized, so it doesn't make sense to store as a base64 string. You're adding 30% data overhead to transform a string into a string. Base64 is useful for serializing opaque binary formats.
Lastly, some people might be getting a wry smile that you have the power of a relational database but are just trying to store "json" rather than an actual relational model.
[flagged]
I'd be a little less reflexively hostile if the prompting used to generate it was prominently included, so that it was at least possible to see which properties of the output were deliberately asked for. When I read a piece of code I don't understand, ideally I'm able to assume that the author intended what was written, and learn something when I figure out why. With AI generated code, I can't do that: the original a…
let x = {}
x['foo'] = bar
This is a parody because the implementation is hidden, and I'm not convinced the implementation isn't just newing an object.Earlier quoted context omitted.
How do you query json with SQL server like let's say you have one data point like this { "id": 42, "quantity": 12, bla bla bla And you want rows where this column has quantity and quantity ≥ 20 How do you do it if you encode everything as base 64?
have col names id, quantity, json and greaterthan20