OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

redis-om python custom primary key

  • Thread starter Thread starter AmitGK
  • Start date Start date
A

AmitGK

Guest
I've been trying to create a custom pk based on fields in the model. https://redis.io/learn/develop/python/redis-om

"The default ID generation function creates ULIDs, though you can change the function that generates the primary key for models if you'd like to use a different kind of primary key."

I would like to customise the generation of primary key based on some of the fields of the model (instance).

I noticed that if i create a field called "pk", redis-om does take this value as the primary key. But is there a way i can just declaratively assign fields as primary key ?

Thanks Amit
<p>I've been trying to create a custom pk based on fields in the model.
<a href="https://redis.io/learn/develop/python/redis-om" rel="nofollow noreferrer">https://redis.io/learn/develop/python/redis-om</a></p>
<p>"The default ID generation function creates ULIDs, though you can change the function that generates the primary key for models if you'd like to use a different kind of primary key."</p>
<p>I would like to customise the generation of primary key based on some of the fields of the model (instance).</p>
<p>I noticed that if i create a field called "pk", redis-om does take this value as the primary key.
But is there a way i can just declaratively assign fields as primary key ?</p>
<p>Thanks
Amit</p>
 

Latest posts

T
Replies
0
Views
1
Thibaud David
T
M
Replies
0
Views
1
MEHRDAD DASHTI
M
Top