Hi
I created a many to many relation between two tables as shown
in the tutorial using Association object as I have extra fields in
connecting table.
I have table User(user_id), Book(book_id) and UserBook(user_id,
book_id)
This code gave me Integrity error of UserBook.user_id of being null.
Basically it is not user id of user automatically to UserBook object :
def con(user, mybook):
ub = UserBook()
ub.book = mybook
user.reads.append(ub)
session.commit()
But this code worked :
def con(user, mybook):
ub = UserBook()
ub.book = mybook
ub.user = user
user.reads.append(ub)
session.commit()
Why the first one is not working?
Regards,
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.