-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
PRs (with tests!) welcomea fix or feature which is appropriate to be implemented by volunteersa fix or feature which is appropriate to be implemented by volunteersdataclassesormorm - annotated declarativeissues with the new annotations-based declarative ORM approachissues with the new annotations-based declarative ORM approachuse casenot really a feature or a bug; can be support for new DB features or user use cases not anticipatednot really a feature or a bug; can be support for new DB features or user use cases not anticipated
Milestone
Description
Discussed in #11894
Originally posted by arimeyer September 19, 2024
On standard dataclasses there is a hash parameter on dataclasses.field: https://docs.python.org/3/library/dataclasses.html#module-contents . When trying to convert from SA 1.4 dataclasses to 2.0, I tried following:
https://docs.sqlalchemy.org/en/20/orm/dataclasses.html#attribute-configuration
https://docs.sqlalchemy.org/en/20/orm/mapping_api.html#sqlalchemy.orm.mapped_column
There was no mention about the "hash" parameter being specifically unsupported in mapped_column(), but when I add it to mirror my 1.4 code and set hash=False for certain fields, I get:
TypeError: init() got an unexpected keyword argument 'hash'
Was this deliberate? If so, what is the workaround?
Metadata
Metadata
Assignees
Labels
PRs (with tests!) welcomea fix or feature which is appropriate to be implemented by volunteersa fix or feature which is appropriate to be implemented by volunteersdataclassesormorm - annotated declarativeissues with the new annotations-based declarative ORM approachissues with the new annotations-based declarative ORM approachuse casenot really a feature or a bug; can be support for new DB features or user use cases not anticipatednot really a feature or a bug; can be support for new DB features or user use cases not anticipated