I've discovered if I use an object (found by session.query) as the value
for the relationship field, I get the issue of having objects being added
without explicit add() method.
But if I insert, for the relationship, the id of the register in database
(of the object got by session.query), I have to use add() method to
actually insert the object in the database.
I guess is better to insert the object instead of use the id of the
register.
But I don't get how to deal with this 'autoload' objects when related...
[]s
Gil
Em quarta-feira, 10 de junho de 2015 15:22:31 UTC-3, Gilcan Machado
escreveu:
Hi.
I'm dealing with a weid situation:
My 'session' is loaded with objects, and when I commit all the objects are
saved in the database, but without any execution of add() method.
How is this possible.
It's a problem to me because I'm creating a lot of objects and return it
as a list to another method. The method filters the list and add() to the
session only what is important.
But when I execute commit() all the objects are inserted.
What I'm doing wrong?
What should I read to understand better the situation.
[]s
Gil
--
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 post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.