Open kantholtz opened 10 months ago
Hi, I've tripped over how the .pk property works for Models.
.pk
Consider this:
>>> from redis_om import HashModel, Field, Migrator ... ... class A(HashModel): ... x: int ... ... class B(HashModel): ... x: int = Field(primary_key=True) ... ... Migrator().run() ... ... a = A(x=3) ... b = B(x=3) >>> a.pk '01H9MZDZRHHDAQZY28F7ETGFHB' >>> b.pk <redis_om.model.model.ExpressionProxy object at 0x7f635ceb1d50>
ExpressionProxy
b.pk
In my opinion, using any HashModel or JsonModel should not require knowledge about whether their pk is auto-generated or explicitly declared.
HashModel
JsonModel
pk
I hope this was not described anywhere in the docs, but I did not find anything.
Hi, I've tripped over how the
.pk
property works for Models.Consider this:
ExpressionProxy
object?b.pk
not 3?In my opinion, using any
HashModel
orJsonModel
should not require knowledge about whether theirpk
is auto-generated or explicitly declared.I hope this was not described anywhere in the docs, but I did not find anything.