SQL, But Make It JSX
Description
A dark themed code editor screenshot shows syntax-highlighted JavaScript or TypeScript code beginning with `export default async function Home() {` and `const data = await query(`. Inside the query call, the code uses XML/JSX-like tags: `<Select>`, `<Where>`, two `<Column>` elements with `name="status" value="paid"` and `name="name" value="bob"`, then `<Limit amount={5} />`, before closing `</Select>` and `);`. The joke is that database querying has been expressed as a React-style component tree, as if SQL, an ORM, and JSX all collided in a frontend framework. For senior developers, it pokes at the tendency of JavaScript ecosystems to turn every domain-specific language into familiar component syntax, regardless of whether that improves the abstraction.
Comments
63Comment deleted
When your ORM has a render tree, the database starts asking whether it needs hydration too.
JESUS Comment deleted
I do not understand the Joke edit: wait wtf Comment deleted
EWWWW is this sql in xml Comment deleted
worse, this is SQL in JSX Comment deleted
Tf is that Comment deleted
WHY WHY WHY WHY Comment deleted
NOOOOOOOOOOOOOOOO Comment deleted
finally sqxml Comment deleted
WHYYYY Comment deleted
SQML Comment deleted
this is SQL-in-JS Comment deleted
I just installed ms sql server manager, don't make me uninstall it Comment deleted
wow, my coworker once created a json to sql converter so frontend developers could write queries directly for db This is so much worse Comment deleted
this is TERRIBLE Comment deleted
It's literally Sequelize Comment deleted
ok ok ok but what if const data = await query({ select: { where: [ { column: "status", value: "paid" }, { column: "name", value: "bob" } ], limit: 5 } }); Comment deleted
Better still not good Comment deleted
wdym better this was supposed to be worse Comment deleted
Worse than XML? Impossible. Comment deleted
Same Comment deleted
JS is a suck at data types Comment deleted
const data = await query({ select: { where: [ { column: "status", value: "paid" }, { column: "name", value: "bob" } ], limit: 5 } }); Comment deleted
is this the triple backtick block like in markdown? Comment deleted
Yep, just open with `javascript Comment deleted
apparently it can autodetect the language Comment deleted
Sounds like fun thing Comment deleted
Wow Comment deleted
But, I mean, why not? Comment deleted
mfw I saw this Comment deleted
mfw ? Comment deleted
my face when Comment deleted
Is it fake? Comment deleted
You better pray for it being fake 👀 Comment deleted
Well …. hard to believe it can be true from the choice of jsx for SQL. Even style components use the backtick technique for css… Comment deleted
I mean, styled-components use backticks because they are designed to be practical, as opposed to this Comment deleted
I wonder how backticks are practical. Why use strings and write weird custom plugins to have at least syntax highlighting in them when you can just implement a dsl in JavaScript and get all of its extensive tooling for free? Comment deleted
apparently because people want CSS, not something that looks like but isn't quite CSS Comment deleted
Damn it becomes real now https://blogs.oracle.com/mysql/post/introducing-javascript-support-in-mysql Comment deleted
wtf Comment deleted
lol… am I the only one thinking where’s the FROM? Comment deleted
or select what? Comment deleted
Probably select all if not specified 😂 Comment deleted
const data = await.db .from("programming_languages") .select({ name: true, }) .where({ skill: "lower", }) .orderBy({ dev_count: "ASC" }) .limit(3) .execute(); Better? Comment deleted
fatal error Comment deleted
Wtf is this? Comment deleted
jsqml Comment deleted
Content-type: "query/select" Location: "http://whe.re?status=paid&name=bob" Content-length=5 Comment deleted
select from which table? Comment deleted
THE table Comment deleted
don't you know there is only one table? Comment deleted
containing, among other columns, "table_id", which is itself linked to a title via a master meta-sub-table Comment deleted
Wonder what a Delete; would do Comment deleted
See liquibase migrations, same xml style, although you can write native queries there too Comment deleted
BTW JSX is really expressive and could've been used for so much more than just HTML if only it was standardized and properly supported in typescript. Comment deleted
It is Comment deleted
Canonical event Comment deleted
Lol.. some people are trying to implement this shit Comment deleted
Reason what makes me hate tech world Comment deleted
https://www.stilldrinking.org/programming-sucks Comment deleted
When I say I hate this tech world, I don't mean I hate programming. Programming is fun...love it. Comment deleted
Waiting till this appears in the frontend pages lol Comment deleted
@riedlers_dev_bot Comment deleted