For example, if I have User class which is mapped to user table. In user table there is a single row, whose id (primary key) equals 1, like this:
> id | name | gender | address > 1 John male second best bathroom street, toilet#2 > now I have this code: > u = User(id=1) > session.merge(u) > session.commit() > because the incoming data contains only id attribute and nothing more, should I expect after execution the above code will wipe out that row and get something like this: > id | name | gender | address > 1 Null Null Null > My reason for such expectation is because of this in documentation: > For mapped attributes which aren’t present on the source, the attribute > is expired on the target instance, discarding its existing value. > By the way, does this have something to do with "If load is passed as False, the incoming data is *stamped* directly "? Thanks. On Tuesday, July 15, 2014 5:57:59 PM UTC-7, Bao Niu wrote: > > In the documentation for *session.merge()* method, there is a section on > the mechanism of reconciling if the *load=true* is set: > >> If the load=True flag is left at its default, this copy process emits >> events and will load the target object’s unloaded collections for each >> attribute present on the source object, so that the incoming state can be >> reconciled against what’s present in the database. If load is passed as >> False, the incoming data is “stamped” directly without producing any >> history. >> > > I don't quite understand the relationship between "stamped" and without > "stamped". The author is apparently trying to contrast something important > here, but I just couldn't imagine what a stamp could be here. Could someone > explain this process in a newbie-friendlier way please? Thanks. > -- 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.