-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to replace default primary key? #251
Comments
Using the readme example: import datetime
from typing import Optional
from pydantic import EmailStr
from redis_om import HashModel
class Customer(HashModel):
first_name: str
last_name: str
email: EmailStr
join_date: datetime.date
age: int
bio: Optional[str] uuid= "46b8d309-c085-4b52-b88c-7c906a8e6cea"
andrew = Customer(
pk= uuid,
first_name="Andrew",
last_name="Brookins",
email="[email protected]",
join_date=datetime.date.today(),
age=38,
bio="Python developer, works at Redis, Inc."
)
customer = Customer.get(uuid) |
@simonprickett seems like this has been addressed and should be closed |
This solves question 2 but not question 1 The field name is still |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have two use cases in which I would like to replace the default pk field with another field:
I would like to define that a string field named "uuid" to be my primary key field, instead of the default "pk".
I do want to keep the ULID key generator, but just to set it into a field named "uuid" instead of "pk".
same as Bump actions/checkout from 2.3.4 to 2.3.5 #1, just skipping the ULID key generator, allowing me to set the primary key manually.
Is it possible to achieve?
I would like to achieve it for both Json and Hash models.
The documentation on that aspect is not clear enough.
Thanks in advance for anyone who will help.
The text was updated successfully, but these errors were encountered: