diff --git a/src/velofy/db/addresses_pixels.py b/src/velofy/db/addresses_pixels.py index 1d6d496..d11b729 100644 --- a/src/velofy/db/addresses_pixels.py +++ b/src/velofy/db/addresses_pixels.py @@ -10,8 +10,9 @@ from velofy.db import meta class AddressPixelAssociation(meta.Base): """Association pattern between `Address` and `Pixel`. - This approach is needed here mainly because it implicitly - updates the `city_id` and `grid_id` columns. + A plain many-to-many relationship would only set `.address_id` and `.pixel_id`. + This class also copies `.city_id` from the `Address` and `.grid_id` from + the `Pixel`, which the composite foreign keys need for their checks. See: https://docs.sqlalchemy.org/en/stable/orm/basic_relationships.html#association-object