Repository navigation
Description
There is a PR (#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.
Activity
papb commentedon Oct 20, 2019
Thank you. I agree.
papb commentedon Oct 20, 2019
@sushantdhiman Should we add this to the v6 milestone?
javiertury commentedon Jan 25, 2020
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.
papb commentedon Jan 26, 2020
Hi @javiertury, thank you again for all the effort you made here. Hopefully at some point I will be able to continue from where you stopped (if no one does it first). Thanks!!
mschipperheyn commentedon Jan 26, 2020
@javiertury What library did you migrate to? TypeORM? I'm also considering moving away for the same reason. There seems to be 0 interaction with the community about priorities and choices. Extremely disappointing. Sequelize seems to have become a @sushantdhiman one man show with a focus on very small steps.
javiertury commentedon Jan 26, 2020
@mschipperheyn, first I want to clarify my point of view. I don't think that @sushantdhiman is at fault, it's hard to be a maintainer of large projects like this. There are many trade offs: a stable interface, new features, robustness, etc.
I think of it as a mismatch of goals. Sequelize is a conservative library and I needed flexibility, that's why I switched to Objection ORM + knex. It's more complicated to use, but I can add all the features I need using 3rd party plugins or develop my own.
Finally, I won't answer more offtopic questions in this thread. Nothing personal, don't get offended.
mschipperheyn commentedon Jan 26, 2020
Fair enough. I might be overly negative. But it's the vibe I'm getting. Thanks for sharing your point of view.
github-actions commentedon Nov 6, 2021
This issue has been automatically marked as stale because it has been open for 7 days without activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment or remove the "stale" label. 🙂
ephys commentedon Apr 25, 2022
Properly supporting bind parameters is a priority of mine, I have a few bind-related tasks in my backlog.
With #14447 and #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
updateandinsertcould follow if there is interest, but it's incompatible with the planned API design for prepared statements.ephys commentedon Feb 20, 2023
I have an update on this.
We've done a lot of internal work and I believe we'll be able to add the global option I mentioned in the above post. That option will let you choose whether a given query will use bind parameters or replacements.
Something like this:
[-]V6: Support for bind parameters[/-][+]Support for bind parameters[/+]