Simon, thanks for the suggestion with association proxies I used them once
in the past.
Richard, I see your point this design might indeed have some unintended
consequence.
As I mentioned in the first message I am aware that it's an unusual
approach and this is a deliberate choice. I just wante
On 1/28/20 9:03 AM, 'Radoslaw Krzak' via sqlalchemy wrote:
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 sho
You'd be able to use traditional relationship definitions if you
defined an "AddressGroup" table where address_id was unique. Company
and Address would both have one-to-many relationships to the
AddressGroup table, and you could probably use association proxies for
Company.addresses and Address.com
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
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
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
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
Hello,
I have a ManyToMany relationship between two tables, although I am not
using "foreign keys" to establish it (this is a deliberate decision that I
wouldn't like to explain more at this point). However, I am struggling to
define this relationship using SQLAlchemy. At the very beginning, I