def select_all():
    treatments = []
    sql = "SELECT * FROM treatments"
    results = run_sql(sql)
    for row in results:
        animal = animal_repository.select(row["animal_id"])
        treatment = Treatment(
            row["decription"],
            row["duration"],
            row["recovery"],
            row["cost"],
            animal,
            row["id"],
        )
        treatment.start = row["start"]
        treatments.append(treatment)
    return treatments
def select(animal):
    treatment = None
    sql = "SELECT * FROM treatments WHERE animal_id = %s"
    values = [animal.id]
    row = run_sql(sql, values)
    if len(row) > 0:
        row = row[0]
        treatment = Treatment(
            row["description"],
            row["duration"],
            row["recovery"],
            row["cost"],
            animal,
            row["id"],
        )
        treatment.start = row["start"]
    return treatment