-
Notifications
You must be signed in to change notification settings - Fork 254
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
Dataclass Mapping changed in sqalchemy 2.0 #248
Comments
Yeah, this needs updating. I'm not going to be working on this project for a little while (I have a queue of more urgent issues to address) so a PR would go a long way towards addressing this. |
Try latest |
Or try RC versions from pypi, for example: |
|
How then would you explicitly set the primary key value on insert? |
True. But how would you let the server set it otherwise? You are not allowed to make an instance without the id |
This is a dilemma I haven't been able to figure out yet. As you probably know, SQLAlchemy really lets you do it either way, and it's just the annotations that are the issue here. |
Yeah I was just trying to figure out if it's possible. Doesn't seem like it. They don't really mention anything about it in the docs. |
Refer: https://docs.sqlalchemy.org/en/20/orm/dataclasses.html#orm-declarative-native-dataclasses
Current documented dataclass style is:
or at least:
Columns type should be
Mapped[int]
notint
which is different with current sqlacodegen and the newmapped_column
is much more readable.The text was updated successfully, but these errors were encountered: