Re: [sqlalchemy] Bidirectional many-to-many without foreign key

2020-01-28 Thread 'Radoslaw Krzak' via sqlalchemy
Yes, exactly :) My goal was to set up *read only* relationship. I have no idea if writable one is possible without the secondary table. On Tuesday, January 28, 2020 at 3:42:36 PM UTC, Simon King wrote: > > So conceptually, an address_id represents a *group* of addresses. A > company can be asso

Re: [sqlalchemy] Bidirectional many-to-many without foreign key

2020-01-28 Thread Simon King
So conceptually, an address_id represents a *group* of addresses. A company can be associated with exactly one group of addresses, and one group of addresses can be shared by multiple companies. Is that right? A normal many-to-many relationship involves an association table. When you add and remov

Re: [sqlalchemy] Bidirectional many-to-many without foreign key

2020-01-28 Thread 'Radoslaw Krzak' via sqlalchemy
Hey Simon, *address_id* is *not* a primary key and is not unique across the *addresses* table. *One* *Company* can reference *many* addresses rows (because there might be multiple rows with the same *address_id* value, hmm maybe I should have used a different name) and vice-versa, *one* *Addres

Re: [sqlalchemy] Bidirectional many-to-many without foreign key

2020-01-28 Thread Simon King
Company has an address_id column, which means each company only has a single address, doesn't it? ie. this is a many-to-one relationship, not a many-to-many? Simon On Mon, Jan 27, 2020 at 11:28 PM Radek Krzak wrote: > > Hello, > > I have a ManyToMany relationship between two tables, although I a