refactor(MSExecutionContext): improve identity insert handling and va…#12297
refactor(MSExecutionContext): improve identity insert handling and va…#12297koenlists wants to merge 8 commits intosqlalchemy:mainfrom
Conversation
…lidation
- Refactored method in to improve readability and maintainability:
- Extracted identity insert logic into helper methods:
- : Determines if identity insert should be enabled.
- : Handles warnings or errors based on .
- Simplified the method by delegating responsibilities to these helper methods.
- Added validation for in :
- Ensures is one of , , or .
- Raises for invalid values.
- Improved type safety and clarity for identity insert behavior.
- Added warnings and error messages to guide users when is set to or .
This refactor enhances code organization, reduces redundancy, and ensures consistent behavior for identity insert handling.
CaselIT
left a comment
There was a problem hiding this comment.
Thanks for the PR, I've left a few comments.
Could you also add a changelog file, see https://github.com/sqlalchemy/sqlalchemy/tree/main/doc/build/changelog/unreleased_21 for examples. the number refer to the issue.
Also it would be nice to have some tests. the existing ones are here
(feel free to mention it if you prefer if one of the maintainer takes this over )
…d removed inputvalidation
Refactored Identity insert logic based on comments
Added unit tests for the new methods
Added changelog
This pull request is:
- [x] A short code fix
- please include the issue number, and create an issue if none exists, which
must include a complete example of the issue. one line code fixes without an
issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests. one line code fixes without tests will not be accepted.
**Have a nice dayadd .*
sqla-tester
left a comment
There was a problem hiding this comment.
OK, this is sqla-tester setting up my work on behalf of zzzeek to try to get revision d25b6e4 of this pull request into gerrit so we can run tests and reviews and stuff
|
New Gerrit review created for change d25b6e4: https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/5790 |
|
Michael Bayer (zzzeek) wrote: OK this is the first I am looking at this as well as at the issue that was posted and I'd like to make significant changes. When we change a behavior in SQLAlchemy, the path is:
So at the moment this patch needs all three of these things added. I propose the API be this:
Note that execution options can be established at several different scopes, including per-connection, per-engine, per statement, per-execute. To keep things simple, since So when the above option is present in I think the entire patch in base.py can be summed up as below: thoughts? View this in Gerrit at https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/5790 |
|
I'm not sure we need a new way of doing things. The change was just because sqlalchemy does by default a kinda surprising thing, so the idea was to let users to control that, opting into it or not explicitly. That said if you prefer to migrate to an execution option, that's fine too for me, but it's kind of optional in this case. |
Fixes: #11620
Description
This refactor enhances code organization, reduces redundancy, and ensures consistent behavior for identity insert handling.
Checklist
This pull request is:
must include a complete example of the issue. one line code fixes without an
issue and demonstration will not be accepted.
Fixes: #<issue number>in the commit messageinclude a complete example of how the feature would look.
Fixes: #<issue number>in the commit messageHave a nice day!