Skip to content
DevMeme
5258 of 7590
Frontend Post #5766 · source on Telegram

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

63
Anonymous ★ Top Pick When your ORM has a render tree, the database starts asking whether it needs hydration too.
  1. Anonymous ★ Top Pick

    When your ORM has a render tree, the database starts asking whether it needs hydration too.

  2. @purplesyringa 2y

    JESUS

  3. @Sp1cyP3pp3r 2y

    I do not understand the Joke edit: wait wtf

  4. @ZgGPuo8dZef58K6hxxGVj3Z2 2y

    EWWWW is this sql in xml

    1. @purplesyringa 2y

      worse, this is SQL in JSX

      1. @ZgGPuo8dZef58K6hxxGVj3Z2 2y

        Tf is that

  5. @sylfn 2y

    WHY WHY WHY WHY

  6. @danogentili 2y

    NOOOOOOOOOOOOOOOO

  7. @Vincent_Hawks 2y

    finally sqxml

  8. @danogentili 2y

    WHYYYY

  9. @callofvoid0 2y

    SQML

  10. @purplesyringa 2y

    this is SQL-in-JS

  11. @ZgGPuo8dZef58K6hxxGVj3Z2 2y

    I just installed ms sql server manager, don't make me uninstall it

  12. @IliaKurenkov 2y

    wow, my coworker once created a json to sql converter so frontend developers could write queries directly for db This is so much worse

    1. @purplesyringa 2y

      this is TERRIBLE

    2. @despac1to 2y

      It's literally Sequelize

  13. @Vincent_Hawks 2y

    ok ok ok but what if const data = await query({ select: { where: [ { column: "status", value: "paid" }, { column: "name", value: "bob" } ], limit: 5 } });

    1. @ZgGPuo8dZef58K6hxxGVj3Z2 2y

      Better still not good

      1. @Vincent_Hawks 2y

        wdym better this was supposed to be worse

        1. @EricKotato 2y

          Worse than XML? Impossible.

          1. @ZgGPuo8dZef58K6hxxGVj3Z2 2y

            Same

    2. @CcxCZ 2y

      JS is a suck at data types

    3. Денис 2y

      const data = await query({ select: { where: [ { column: "status", value: "paid" }, { column: "name", value: "bob" } ], limit: 5 } });

      1. @Vincent_Hawks 2y

        is this the triple backtick block like in markdown?

        1. Денис 2y

          Yep, just open with `javascript

          1. @Vincent_Hawks 2y

            apparently it can autodetect the language

    4. @GLXBX 2y

      Sounds like fun thing

  14. @GLXBX 2y

    Wow

  15. @GLXBX 2y

    But, I mean, why not?

  16. @Jiujiteir0 2y

    mfw I saw this

    1. @callofvoid0 2y

      mfw ?

      1. @Jiujiteir0 2y

        my face when

  17. @dsmagikswsa 2y

    Is it fake?

    1. dev_meme 2y

      You better pray for it being fake 👀

      1. @dsmagikswsa 2y

        Well …. hard to believe it can be true from the choice of jsx for SQL. Even style components use the backtick technique for css…

        1. @purplesyringa 2y

          I mean, styled-components use backticks because they are designed to be practical, as opposed to this

          1. @x4erem6a 2y

            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?

            1. @purplesyringa 2y

              apparently because people want CSS, not something that looks like but isn't quite CSS

      2. @dsmagikswsa 2y

        Damn it becomes real now https://blogs.oracle.com/mysql/post/introducing-javascript-support-in-mysql

        1. @callofvoid0 2y

          wtf

  18. Deleted Account 2y

    lol… am I the only one thinking where’s the FROM?

    1. @callofvoid0 2y

      or select what?

      1. Deleted Account 2y

        Probably select all if not specified 😂

  19. @oljimenez 2y

    const data = await.db .from("programming_languages") .select({ name: true, }) .where({      skill: "lower", }) .orderBy({ dev_count: "ASC" }) .limit(3) .execute(); Better?

    1. @callofvoid0 2y

      fatal error

  20. @paul_thunder 2y

    Wtf is this?

    1. @callofvoid0 2y

      jsqml

  21. @azizhakberdiev 2y

    Content-type: "query/select" Location: "http://whe.re?status=paid&name=bob" Content-length=5

  22. @im_ali_pj 2y

    select from which table?

    1. @purplesyringa 2y

      THE table

      1. @purplesyringa 2y

        don't you know there is only one table?

        1. @purplesyringa 2y

          containing, among other columns, "table_id", which is itself linked to a title via a master meta-sub-table

      2. Deleted Account 2y

        Wonder what a Delete; would do

  23. @edmorra 2y

    See liquibase migrations, same xml style, although you can write native queries there too

  24. @x4erem6a 2y

    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.

  25. Deleted Account 2y

    It is

  26. @Art3m_1502 2y

    Canonical event

  27. Deleted Account 2y

    Lol.. some people are trying to implement this shit

    1. Deleted Account 2y

      Reason what makes me hate tech world

      1. @CcxCZ 2y

        https://www.stilldrinking.org/programming-sucks

        1. Deleted Account 2y

          When I say I hate this tech world, I don't mean I hate programming. Programming is fun...love it.

  28. @FunnyGuyU 2y

    Waiting till this appears in the frontend pages lol

  29. Deleted Account 2y

    @riedlers_dev_bot

Use J and K for navigation