Skip to content

TypeAdapter don't work with table=True #905

Discussion options

You must be logged in to vote

Well it looks like TypeAdapter default validation does not take care of _sa_instance_state.

To make your code works I changed the following, forcing the call of Daily.model_validate to properly instantiate an object compatible with sqlalchemy.

daily_adapter = TypeAdapter(list[Annotated[Daily, BeforeValidator(Daily.model_validate)]])

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@davisylvestre
Comment options

Answer selected by davisylvestre
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
2 participants