Good afternoon community

I have the following tables:

   - Survey
   - Answer
   - Question
   - SurveyAnswer (Association table)

My association table has 3 foreign keys that relates to Answer, Question 
and Survey.
A Survey has many Questions, many Answers.

When I insert a survey object into the db, SqlAlchemy creates two seperate 
entries for both questions and answers relating to the Survey instead of 
adding them in the same data set.

I would appreciate any guidance regarding this issue. Thank you in advance. 
Here is a screenshot of my db models:
[image: many to many.png]
Here is an example of what happens after inserting a Survey objet to the db:
[image: SurveyAnswerInsertion.png]
As you can see it seems to me that it inserts the first dataset for answers 
then afterwards inserts the questions' dataset. I would like to have these 
integrated into the same rows. 
I am not sure if I am doing something wrong. 

Once again thank you for your help

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/4249ef32-27e9-405d-ab9c-472b28f00917n%40googlegroups.com.

Reply via email to