Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
1.3 kB
2
Indexable
Never
/Users/Martunia/PycharmProjects/Animals_database/venv/bin/python /Users/Martunia/PycharmProjects/Animals_database/AnimalRepository.py 
Traceback (most recent call last):
  File "/Users/Martunia/PycharmProjects/Animals_database/venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 2636, in add
    state = attributes.instance_state(instance)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Animal' object has no attribute '_sa_instance_state'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/Martunia/PycharmProjects/Animals_database/AnimalRepository.py", line 16, in <module>
    service.add_to_database(cat)
  File "/Users/Martunia/PycharmProjects/Animals_database/AnimalRepository.py", line 9, in add_to_database
    session.add(animal)
  File "/Users/Martunia/PycharmProjects/Animals_database/venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 2638, in add
    util.raise_(
  File "/Users/Martunia/PycharmProjects/Animals_database/venv/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
    raise exception
sqlalchemy.orm.exc.UnmappedInstanceError: Class 'main.Animal' is not mapped

Process finished with exit code 1