Get the latest tech news
Writing Composable SQL Using Knex and Pipelines
Despite all its strengths, SQL can be awkward to integrate with host languages such as JavaScript and Python. There’s often an impedance mismatch between SQL’s declarative nature and the host language’s object-oriented or functional paradigms – SQL queries are typically written as strings within the host language, making it difficult to apply composable programming techniques…
Several solutions have been developed over the years to address the impedance mismatch, with ORM (Object-Relational Mapping) libraries being one of them. ORMs such as Java’s Hibernate are widely used to model a relational database using objects, but there are various difficulties in making them work well. Knex uses a fluent interface to build queries, making it possible to modify them by simply chaining additional methods.
Or read this on Hacker News