Closed junhopark97 closed 5 months ago
Thanks for reporting this @junhopark97! I am able to reproduce this. According to git bisect
, it seems #502 broke something.
Actually, this may be due to something in advanced-alchemy
because the following works:
from uuid import UUID
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
from polyfactory.factories.sqlalchemy_factory import SQLAlchemyFactory
class Base(DeclarativeBase):
...
class User(Base):
__tablename__ = "users"
id: Mapped[UUID] = mapped_column(primary_key=True)
class UserFactory(SQLAlchemyFactory[User]):
pass
assert isinstance(UserFactory.build().id, UUID)
@cofin any ideas?
Looking here https://github.com/jolt-org/advanced-alchemy/blob/main/advanced_alchemy/types/guid.py#L38 it seems the mapped typed for UUID in advanced alchemy uses binary under the hood.
By my understanding, TypeEngine.impl.python_type
would be the internal type passed to a particular dialect engine. I think should prioritise TypeEngine.python_type
over TypeEngine.impl.python_type
Thanks @guacs, @adhtruong!
Description
In the example below,
UserFactory.build().id
outputs a UUID.When upgrading from version
polyfactory==2.14.1
topolyfactory==2.15.0
, it is observed thatUserFactory.build().id
now outputs Bytes instead of a UUID.Is the output in Bytes intended? Am I missing something?
MCVE
Steps to reproduce
No response
Screenshots
No response
Logs
Release Version
2.15.0
Platform