Re: [sqlalchemy] Behaviour when setting a foreign key column.

2020-12-14 Thread João Miguel Neves
Hi Simon, Thank you very much. And this also explains why the problem appeared in tests. Best regards, João On Mon, 14 Dec 2020 at 14:51, Simon King wrote: > You have missed something important, but I don't know if it will clear > up all your questions :-) > > In your example, c.company_id

Re: [sqlalchemy] Behaviour when setting a foreign key column.

2020-12-14 Thread Simon King
You have missed something important, but I don't know if it will clear up all your questions :-) In your example, c.company_id doesn't get populated until the first flush. Until then, c.company_id is None. So when you wrote: # Case 1: update the _id doesn't seem to reflect p.company_id =

[sqlalchemy] Behaviour when setting a foreign key column.

2020-12-14 Thread João Miguel Neves
Hi all, I'm sorry, as I feel like this is kind of a beginner question. I'd expect that when I set a column attribute the respective relationship field would change or at least be marked as changed (so a posterior access can be loaded later on another access), but I've found a case where it