Closed HendrixString closed 1 month ago
There's nothing like that in kysely and you should never execute a query built like that. That's like db programming 101. You'll get fired if you do that 😅
Hey 👋
If you must (e.g. some relational database/API doesn't support parameters), and understand the risks, you have two options:
appendValue
method in your query compiler to call appendImmediateValue
instead.ImmediateValuePlugin
from the source code: https://github.com/kysely-org/kysely/tree/master/src/plugin/immediate-value. Note, this is an internal plugin.YOU ARE FULLY RESPONSIBLE IF ANYTHING HAPPENS. DON'T DO IT.
Hi @igalklebanov , thanks for the tips.
It is mostly for education purposes, because D1 only allows for multiple statements without parameters over http rest API.
I am just loudly rethinking some of the constraints with Kysely, that coincides with some of my favourite cloud services in the realm of query manipulation and execution.
It would have been great for example if:
This will open up diverse scenarios of execution and flexibility, specially with cloud services advocating non interactive transactions, some even don't support it.
I truly believe it is a missing part in Kysely's execution feature.
I am not giving up on Kysely because I do enjoy and appreciate writing a lot of code that is shared between the dialects and then building queries with the same interface and object.
My only custom code are migrations between SQLite, postgres and MySQL and json functions. This is why I chose Kysely.
But I really hope you guys will relax the execution part a bit, so we can target cloud databases without desiring forking Kysely or come up with another original execution pipeline.
I also know more people want this. And, it will help convert more users into Kysely.
Let's create a poll around this
There's nothing like that in kysely and you should never execute a query built like that. That's like db programming 101. You'll get fired if you do that 😅
I was looking for the same functionality in kysely and legitimately don't understand your answer, can you elaborate?
There are benefits of having the values directly in the query string sent to the server, instead of a separate parameter. As long as the fields are escaped properly, that is not harmful at all, your answer seems greatly exaggerated.
Sequelize for example has this option, alongside the bind parameters: the replacements option allows both unnamed parameters in the form of ?
passed through an array sequentially, or :parameterName
which reads from an object.
Hi,
Given a
CompiledQuery
object,How can I bind the
parameters
into thesql
to produce a static and rendered output native query ?