On Tue, Jan 2, 2018 at 12:06 PM, Tim Chen wrote:
> Ah yes, makes sense. So there is a slight difference in that add() will
> modify the original object, while merge() will not. Thanks for the
> explanation!
>
> It would be great if this difference could be added to the docs
Ah yes, makes sense. So there is a slight difference in that add() will
modify the original object, while merge() will not. Thanks for the
explanation!
It would be great if this difference could be added to the docs here
On Tue, Jan 2, 2018 at 11:44 AM, Tim Chen wrote:
> Hrmm, that's not what I'm getting. Maybe I'm misunderstanding something -
> here's a simple test to illustrate my example. test_add() works as
> expected, test_merge() fails.
>
>
> import sqlalchemy as sa
> from
Hrmm, that's not what I'm getting. Maybe I'm misunderstanding something -
here's a simple test to illustrate my example. test_add() works as
expected, test_merge() fails.
import sqlalchemy as sa
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
On Mon, Jan 1, 2018 at 9:18 PM, Tim Chen wrote:
> When I merge() an object without a PK, I expect similar behavior to add(),
> in that the autogenerated PK is returned and set on the object. Is that not
> expected behavior?
it is, assuming the Session has flushed.
>
> --
>
When I merge() an object without a PK, I expect similar behavior to add(),
in that the autogenerated PK is returned and set on the object. Is that
not expected behavior?
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code,