Repository navigation
Conversation
Allow specifying string attribute or column names for the version_id_col parameter in Mapper and Declarative __mapper_args__. During mapper configuration, string names are resolved against mapped properties and the persist_selectable to the underlying ColumnProperty, matching the behavior of polymorphic_on. Fixes: sqlalchemy#6084
|
Hi, and thanks for the pull request! This project accepts pull requests only for issues that a maintainer has already marked with the open for pull requests label. That way we can settle on an approach before anyone spends time writing code. This pull request references issue #6084, which hasn't been marked open for pull requests, so the change isn't authorized yet and I'm closing it automatically. Once a maintainer adds the label to #6084, reopen this pull request and it will stay open. If #6084 needs more detail before that can happen, a complete runnable example is usually the missing piece, and adding one to the issue is the fastest way to get there. This is automatic and procedural. It isn't a judgment on your change, and nothing you've written here is lost. Thanks for your interest in the project! |
Description
Fixes #6084. Allows specifying string attribute or column names for the
version_id_colparameter inMapperand Declarative__mapper_args__.During mapper configuration (
_configure_version_id_col), string attribute or column names are resolved against_propsandpersist_selectable.cto the correspondingColumnProperty, matching the established behavior ofpolymorphic_on.Changes
version_id_colparameter typing inMapper.__init__to accept strings andMapperProperty._configure_version_id_colmethod called during mapper construction to resolve strings and mapper properties into concrete columns, with validation for non-existent and non-column attributes.test/orm/test_versioning.pycovering string attribute names, column names differing from property keys, dataclass mappings with metadata, and polymorphic inheritance.doc/build/changelog/unreleased_21/6084.rst.Checklist
This pull request is:
Fixes: #<issue number>in the commit messageHave a nice day!