Re: [sqlalchemy] Weird SELECT when assigning to one-to-one relationship

2016-02-19 Thread Adrian
Thought something like that.. i did actually find that it's the backref causing it by stepping through tons of SA code ;) So I guess setting it to None explicitly on creation is the correct way to avoid the SELECT? -- You received this message because you are subscribed to the Google Groups "s

Re: [sqlalchemy] Weird SELECT when assigning to one-to-one relationship

2016-02-19 Thread Mike Bayer
so this is uselist=False e.g. one-to-one, you make a Contribution with a non-present timetable entry, when you get to the flush(), it knows nothing about what timetable_entry objects might exist for this row. Unsurprisingly then, if we do this: contrib = Contribution() s.add(contrib) s.flush()

[sqlalchemy] Weird SELECT when assigning to one-to-one relationship

2016-02-19 Thread Adrian
Check this testcase: https://gist.github.com/ThiefMaster/913446490d0e4c31776d When assigning an object to the relationship attribute a SELECT is sent, but this does not happen when explicitly setting the attribute to None before assigning the object to it. If the SELECT being issued is not a bu