Find a way to generate automatically PrimaryKeys instead of coding them
Closed this issue · 1 comments
sorasful commented
IMHO, It would be essential that PrimaryKey()
generates automatically an id, it could even depend on the type we are passing, for example :
class Employee(DataBaseModel):
id: str = PrimaryKey() # could use uuid.uuid4()
id: int = PrimaryKey() # could use random.randint(0, 9e99) (just an example, would need something better)
A possibility would also to set PrimaryKey as Optional, what do you think ?
codemation commented
I probably answered this question in #5 , where you would need to use PrimaryKey(default=)
passing in an argument-less method that will be used to generate almost any type of data at instantiation.