V6: Support for bind parameters
See original GitHub issueThere is a PR (https://github.com/sequelize/sequelize/pull/10284) for bind parameters on SELECT statements in sequelize, a crucial performance related feature. However, it is floundering.
I would like to propose to make this feature an explicit goal of v6. This way it gets the focus and priority it requires.
On a separate note, I think any sequelize version should have an umbrella task that allows debate on priorities and a checkable list of references to individual features.
Issue Description
Support bind parameters across the board
Is your feature request related to a problem? Please describe.
Bind parameters optimize performance and are an expected baseline for modern ORMs.
Describe the solution you’d like
Ideally, I would like bind parameters to be a global option that would allow you to have bind parameters use the already existing { someId: { [Op.eq]: var }
style code, and a query specific option to override the default.
Alternatively, a different syntax could be considered (as is the case with Hibernate) to make the use case explicitly separate.
Why should this be in Sequelize
Performance. It is expected by people deciding on framework use.
Describe alternatives/workarounds you’ve considered
I’ve considered moving to TypeORM because of this. But I’m more familiar with sequelize and my code is in sequelize. I would pref it to be available on sequelize.
Is this issue dialect-specific?
- No. This issue is relevant to Sequelize as a whole.
- Yes. This issue only applies to the following dialect(s): XXX, YYY, ZZZ
Would you be willing to resolve this issue by submitting a Pull Request?
It’s already been done, but likely needs to be re-aligned.
- Yes, I have the time and I know how to start.
- Yes, I have the time but I don’t know how to start, I would need guidance.
- No, I don’t have the time, although I believe I could do it if I had the time…
- No, I don’t have the time and I wouldn’t even know how to start.
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (7 by maintainers)
Properly supporting bind parameters is a priority of mine, I have a few bind-related tasks in my backlog.
With https://github.com/sequelize/sequelize/pull/14447 and https://github.com/sequelize/sequelize/pull/14020, we’ll be able to use bind parameters in many places easily like this:
With more good things to follow such as caching queries using prepared statements & bind parameters, and specifying the type of a bind parameter.
A global option like in
update
andinsert
could follow if there is interest, but it’s incompatible with the planned API design for prepared statements.I appreciate your interest for pull request #10284 about adding bind parameters. Unfortunately, during the last year I migrated all my projects to another sql library. The reason is that, despite all the effort and time I put on sequelize, I didn’t see any progress at all, which is frustrating.
You can still find the bind-params branch in my repo. Feel free to use it as a starting point, just keep in mind that it’s a little bit outdated.