Question for people who actually write app and SQL code: besides convenience, what is the upside of working with JSON in SQL over having your app construct and parse JSON objects, but storing the data in a database using more primitive types? My relatively inexperienced brain is telling me that it’s probably over complex to store and manipulate JSON objects at the DB level.
Against SQL (2021)
71–80 of 81 posts
Re: Against SQL (2021)
#72Earlier quoted context omitted.
Question is: do you need that flexibility if you have the backend for frontend? Can you design such a flexible api which makes it possible to iterate faster? If not, you just pay, in the best case, a constant overhead, or worst case, exponential overhead for each request! If you need to spend time optimizing because you have monitoring for slow queries or downtime caused by never terminating queries than most likely…
I always thought it was about developer velocity, in this particular case front-end. With a traditional REST API the front-end team needed to coordinate with the back-end team on specific UX features to determine what needed to be done, which was further exasperated when API's needed to be specialized for iPhone vs. Android vs. Web UI. GraphQL was supposed to help front-end and back-end meet in the middle by letting…
Re: Against SQL (2021)
#73I work at (what was previously known as) Hasura. Specifically: the connector bits that deal w/ translating Relational Algebra IR expressed as GraphQL nodes -> SQL engine-specific code. The author's comments about lack of standardization and portability might not get across just how nightmarishly different SQL dialects are. I might put together a list of some of the batshit-insane bugs we've run into, even between ver…
Re: Against SQL (2021)
#74Earlier quoted context omitted.
In MSSQL you can select top 0 * into a temp table and retrieve all the usual column meta data. I’ve written basic custom report writer functionality using this technique that lets users(usually me the developer or a super user) do custom sanitised SQL selects. I assume similar functionality exists in all the different vendors databases.
Yes, you can obviously run queries to get that information, but you can’t do it statically very easily. > I’ve written basic custom report writer functionality using this technique that lets users(usually me the developer or a super user) do custom sanitised SQL selects. I’m not sure how having the column metadata helps you sanitize SQL.
Columns are added, removed, pivoted, summed etc by the user running the report. This can’t be static but the OP was mentioning how you can’t get column meta data easily.
By sanitised SQL I mean the query is fed to the MSSQL parser and only select & union all is allowed as far queries go(eg. no delete, drops, updates etc).
Re: Against SQL (2021)
#75Earlier quoted context omitted.
Re: GQL - Explain to me what abstraction layer should exist between the data model and what data is loaded into the client? I’ve never understood why injecting arbitrary complexity on top of the data model is wise. Perhaps unfettered write access has its problems, and GQL has permissions that handle this issue plenty gracefully, but I don’t see why your data model should be obfuscated from your clients which rely on…
In my view the abstraction layer should be in the domain of the application. Let's say your software is HR software and you can add and remove employees. The abstraction is "Add an employee with these details". The data model should be completely independent of the abstraction. I.e. nobody should care how the model is implemented (even if in practice it's maybe some relational model that's more or less standard). Sim…
Taking an HR example, you could query for an employee, their PTO status and accrual history, their manager, and their reports all in one nice easy query that no one has to write any business logic for, just a schema set up with employees, manager, reports, and PTO tables joined on ID keys.
And in such a case, what abstraction does the backend team need to put in front of the schema? I can’t motivate what this means myself. A well designed DB schema is truly a beautiful contract, and with table and column comments you can even get intellisense docs in the IDE for the front end team building the client.
On the flip side, I agree the write operation should be done thru an API when there is complexity and requirements beyond just writing one row to one table, but read operations are much more graceful and speedier to define in GQL than REST.
Re: Against SQL (2021)
#76This is mostly all true, but there is little incentive for RDBMS vendors to implement and maintain a second query language, in particular a shared cross-vendor one. Databases are the most long-lived and costly-to-migrate dependencies in IT systems, so keeping the SQL-based interface in parallel for a long time would be mandatory. This is compounded by the standardized SQL-centric database driver APIs like ODBC and JD…
Re: Against SQL (2021)
#77Earlier quoted context omitted.
The point is that with a more expressive language new features could be added as libraries instead of changing the language itself. This is right before the paragraph I quoted: "In modern programming languages, the language itself consists of a small number of carefully chosen primitives. Programmers combine these to build up the rest of the functionality, which can be shared in the form of libraries. This lowers the…
Yea I know, I was addressing that in my comment? You have languages like JavaScript which are very “expressive” in that it comes with very little functionality but there are a wealth of libraries you can use to augment this. And this tradeoff is often lamented on HN since it’s never enough to just know JS; you have to know the particular libraries being used by the project. Contrast that with batteries included langu…
Re: Against SQL (2021)
#78TL;DR; * a list of things they don't like in sql * a list of traits they think a replacement should exhibit by negating the first list I was kind of hoping for some example of what this much better language should look like
I think the much better language would be the "no language" database. Throw portability to the wind and just have the client ship the query plan directly. The frontend to the database is howerver you want to expose it in your language of choice. I don't think there's any hope of getting disparate db vendors to agree on a compatible frontend language. It seems easier to externalize it. The closest existing database to…
I don't love SQL, but somehow the alternatives haven't beaten it yet
Re: Against SQL (2021)
#79TL;DR; * a list of things they don't like in sql * a list of traits they think a replacement should exhibit by negating the first list I was kind of hoping for some example of what this much better language should look like
Maybe I'm holding TFA wrong but to me it seems like they're hinting at wanting a Prolog-as-database that could also become widely used, unlike actual Prolog. It's not hyper-performant and mega web scale but the object database and Prolog like query language that comes with Picolisp is quite fun and sometimes rather useful, and has helped me think differently about how to model things in the default SQL database engin…
Re: Against SQL (2021)
#80Earlier quoted context omitted.
Maybe I'm holding TFA wrong but to me it seems like they're hinting at wanting a Prolog-as-database that could also become widely used, unlike actual Prolog. It's not hyper-performant and mega web scale but the object database and Prolog like query language that comes with Picolisp is quite fun and sometimes rather useful, and has helped me think differently about how to model things in the default SQL database engin…
It sounds interesting, although I have learnt both SQL and prolog and one was a lot easier
Pilog is similar to both, the basics are kind of easy to learn, it's basically a bit of Lisp:ish syntax and keywords for 'give me a subset from these sets'. But it's a graph of objects instead of tables or atoms.