Can't save an entity to my PostgreSQL Database/suspected cors error

Viewed 32

I inherited an angular project with a postgresql-database using sql-alchemy and pydantic. I edited the student class to contain a relation with a secondary telephone number and other new relations but can't save the new students to my database, getting a "net::ERR_FAILED 500"

sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column "tel_nr2" of relation "student" does not exist heman-api | LINE 1: ...O student (firstname, lastname, birthday, tel_nr, tel_nr2, s...

[SQL: INSERT INTO student (firstname, lastname, birthday, tel_nr, tel_nr2, street, zip, city, mail, specifics, but_nr, class_lvl, class_teacher1, class_teacher1_contact_info, class_teacher2, class_teacher2_contact_info, country_of_origin, mothertongue, school, contact_person, tutor_id) VALUES (%(firstname)s, %(lastname)s, %(birthday)s, %(tel_nr)s, %(tel_nr2)s, %(street)s, %(zip)s, %(city)s, %(mail)s, %(specifics)s, %(but_nr)s, %(class_lvl)s, %(class_teacher1)s, %(class_teacher1_contact_info)s, %(class_teacher2)s, %(class_teacher2_contact_info)s, %(country_of_origin)s, %(mothertongue)s, %(school)s, %(contact_person)s, %(tutor_id)s) RETURNING student.id] heman-api | [parameters: {'firstname': 'asd', 'lastname': 'asd', 'birthday': None, 'tel_nr': 'asd', 'tel_nr2': None, 'street': None, 'zip': None, 'city': None, 'mail': None, 'specifics': None, 'but_nr': '0', 'class_lvl': None, 'class_teacher1': None, 'class_teacher1_contact_info': None, 'class_teacher2': None, 'class_teacher2_contact_info': None, 'country_of_origin': None, 'mothertongue': None, 'school': None, 'contact_person': None, 'tutor_id': None}] heman-api | (Background on this error at: https://sqlalche.me/e/14/f405)

I also get this cors error: "Access to XMLHttpRequest at 'https://api.hallo-einstein.de/students/' from origin 'https://manager.hallo-einstein.de' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource." although i set allow_origins = ["*"], this hasn't been a problem before though. I double and triplechecked and the relation should exist 100% with this name. I'm honestly a little bit lost and would appreciate any input :)

0 Answers
Related