I am implementing a database in Python for animals. Class to create an Animal
object:
class Animal:
def __init__(self, name: str, animal_type: str, birth_date: str, added_date: str, gender: str,
description=None, image=None) -> None:
self.id = str(uuid.uuid4())
self.name = name.capitalize()
self.animal_type = animal_type.capitalize()
self.birth_date = birth_date
self.added_date = added_date
self.gender = gender
self.description = description
self.image = image
On the database table the only UNIQUE key is id
. If I want to get a specific animal from the database all properties of that animal should match. Is there a more efficient way to do it?
When I create a new animal a new UUID will be created, so if I want to find or update a specific animal in the database I can't find the animal using the UUID.