Replies: 1 comment
-
Hey @MetaHG , sorry for the slow reply!
Hope this helps! :) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
I have a few questions regarding unique constraints set on some SQLAlchemy
String(n)
field.Let's say I have the following model for the sake of example:
cls.__faker__.unique.[my_string_method]
?code(name: Mapped[str] = mapped_column(String(5), nullable=False, unique=True, index=True))
in our modelUser
? As the faker instance is shared inside the factory I believe, it seems that theUniqueProxy
ofcls.__faker__
will be shared as well. While the size of the generated strings are different in that case, overlaps could be encountered if two unique fields of the same type are declared. Is it correct?I could imagine something like the following for question 3.:
__faker__.unique._seen
.__faker__.unique.generate_some_str_func
This is just a rough sketch and this implementation would be brittle because
_seen
is not supposed to be exposed. Any better idea is welcomed.Thank you for your help, and any examples or guidance would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions