-
Notifications
You must be signed in to change notification settings - Fork 802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specify ignored attributes in mappings #1927
Comments
There is no way to do this currently, but using |
miguelgrinberg
added a commit
to miguelgrinberg/elasticsearch-dsl-py
that referenced
this issue
Nov 5, 2024
miguelgrinberg
added a commit
that referenced
this issue
Nov 6, 2024
* Do not map ClassVar attributes Fixes #1927 * document ClassVar usage (cherry picked from commit 47a7a06) Co-authored-by: Miguel Grinberg <[email protected]>
miguelgrinberg
added a commit
to miguelgrinberg/elasticsearch-dsl-py
that referenced
this issue
Dec 9, 2024
* Do not map ClassVar attributes Fixes elastic#1927 * document ClassVar usage
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SQLAlchemy interprets the
ClassVar
type annotation to mean a non-mapped variable which the ORM can safely ignore. This is great, since it lets us populate special fields at runtime without IDEs complaining about unresolved attributes (and, if the value is read before being set, it doesn't risk causing a runtime exception).Is there a way to emulate this with Document mappings? We could pre-populate the fields to be empty strs/lists/dicts, but that means re-building our indices every time we want to add/remove special attributes or change their types.
The text was updated successfully, but these errors were encountered: