3 ms·
I see query builders as a learning tool for fresh developers, and as a job aid for business analysts. For some this can be the final destination, but for any de
by bob1029 7y ago
I see query builders as a learning tool for fresh developers, and as a job aid for business analysts. For some this can be the final destination, but for any developer I would push hard to get them writing SQL by hand ASAP.
A few weeks of suffering through DIY SQL is really the only way to fundamentally understand how the database is working for (or against) you. Once you learn it, it really does become like a second language. You can fade in and out of proficiency based on recency of exposure, but it is mostly like riding a bicycle. One other advantage is you can take it across any SQL platform without a second thought. Many ORMs have provider-specific compatibility woes to contend with.
- syntheticcdo 7y agoI disagree. Knex isn't an abstraction over SQL itself, as much as an abstraction over the tedious process of writing literal strings, which let's the developer treat SQL queries as code. My process is generally - write SQL to find the best query, then convert the SQL to Knex for integration. As a simple example, say you are making a simple query to the db, but in some edge cases you need another column to be selected. Knex lets you do this: let query = KNEX("table").select("col_1") if(weirdCondition) { query = query.select("col_2") } const rows = await query Which naturally compiles into either SELECT col_1 FROM table or SELECT col_1, col_2 FROM table
- celticmusic 7y agoquery builders are useful for building queries dynamically.