if the database you're using supports transactions (meaning, not MySQL + MyISAM engine), and you're not using "autocommit" (which is usually the case), then you always need to commit() for anything to be committed. moving relationships around has no special significance.
On Apr 26, 2013, at 11:48 PM, Mauricio de Abreu Antunes <mauricio.abr...@gmail.com> wrote: > I think I'm answering myself: > > address = Address(args) # passing jack's id > session.add(address) > session.commit() > > > 2013/4/27 Mauricio de Abreu Antunes <mauricio.abr...@gmail.com> > Being more specific I talk about this part: > > > >>> jack = User('jack', 'Jack Bean', 'gjffdd') > >>> jack.addresses > [] > > >>> jack.addresses = [ > ... Address(email_address='j...@google.com'), > ... Address(email_address='j...@yahoo.com')] > > Are addresses automaticamente added and commited? > I know it is commiting jack and jack has addresses, but how do i add jack > first (session 1) and right after commiting jack without addresses add a set > of addresses and commit them to the database? > > 2013/4/26 Mauricio de Abreu Antunes <mauricio.abr...@gmail.com> > Everytime I code SQLAlchemy relationships I note that insert operation like > this (tutorial) does not need commit() > http://docs.sqlalchemy.org/en/latest/orm/tutorial.html#working-with-related-objects > > When using this bidirectional relationship() is the data automatically > commited to the dabase? > > Probably this is an easy question but I can not get how to perform a rollback > in jack.addresses. > > -- > Mauricio de Abreu Antunes > Mobile: (51)930-74-525 > Skype: mauricio.abreua > > > > -- > Mauricio de Abreu Antunes > Mobile: (51)930-74-525 > Skype: mauricio.abreua > > > > -- > Mauricio de Abreu Antunes > Mobile: (51)930-74-525 > Skype: mauricio.abreua > > -- > 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?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.