Re: [sqlalchemy] Trying to understand FlushErrors when merging

2020-09-11 Thread Jacob Pavlock
Awesome, thanks so much for the help and the ideas. I think I have some good info to go off of and definitely have a better understanding of how my application works wrt to sqlalchemy. On Friday, September 11, 2020 at 7:02:51 AM UTC-5 Mike Bayer wrote: > > > On Fri, Sep 11, 2020, at 2:26 AM,

Re: [sqlalchemy] Trying to understand FlushErrors when merging

2020-09-11 Thread Mike Bayer
On Fri, Sep 11, 2020, at 2:26 AM, Jacob Pavlock wrote: > > Mike, > > Thanks for the great explanation and the quick response! I think am I > starting to get it now. I guess the same or similar idea though leads to the > following (somewhat confusing) behavior: > > (I added a repr and

Re: [sqlalchemy] Trying to understand FlushErrors when merging

2020-09-11 Thread Jacob Pavlock
Mike, Thanks for the great explanation and the quick response! I think am I starting to get it now. I guess the same or similar idea though leads to the following (somewhat confusing) behavior: (I added a repr and setters for the hybrid properties) track1 = Track(album="tpab",

Re: [sqlalchemy] Trying to understand FlushErrors when merging

2020-09-10 Thread Mike Bayer
When you create a Track object and don't assign the primary key attributes directly, the instance key of the object is all nulls: Track.__mapper__.identity_key_from_instance(track1) (, (1, None, None, None), None) Track.__mapper__.identity_key_from_instance(track2) (, (1, None, None, None),

[sqlalchemy] Trying to understand FlushErrors when merging

2020-09-10 Thread Jacob Pavlock
Hello! I am new to sqlalchemy and was hoping to get some insight on the following issue: import sqlalchemyfrom sqlalchemy import Column, Integer, Stringfrom sqlalchemy.ext.declarative import declarative_basefrom sqlalchemy.ext.hybrid import hybrid_propertyfrom sqlalchemy.orm import