Open CristhianMotoche opened 4 years ago
I double this, faced same issue with pydantic and sqlalchemy. Is there are a change for this to be fixed?
Yes Please! Same here
I faced this issue, solved using 1.0.7 version
i changed the lines from:
if type(type_from) is not type:
raise ObjectMapperException("type_from must be a type")
if type(type_to) is not type:
raise ObjectMapperException("type_to must be a type")
to:
if (not isinstance(type_from, type)):
raise ObjectMapperException("type_from must be a type")
if (not isinstance(type_to, type)):
raise ObjectMapperException("type_to must be a type")
this worked well for me.
Hello!
I've been looking for a library like this one and I think it can be pretty useful. I want to use it to convert an object that is mapped from a table of my database (I'm using Tortoise ORM for this):
to a simple plain object that I use in my use cases (business logic):
Then, my mapper should be something like:
But,
SessionTable
isn't atype
:so, it fails with
ObjectMapperException: type_from must be a type
andObjectMapperException: type_to must be a type
during the map creationcreate_map
.Does it make sense to add a flag to avoid those asserts?
Although, I'm not sure if that would work since all data members need a default value. BTW, is it possible to solve that issue? If it is, I'd like to give it a try.