Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sqlalchemy warning for activity_products__eager #111

Merged
merged 1 commit into from
May 23, 2022

Conversation

nmalaguti
Copy link
Contributor

The following warning is given when running migrations:

SAWarning: relationship 'Item.activity_products__eager' will copy column
item.id to column activity_product.item_id, which conflicts with
relationship(s): 'ActivityProduct.blueprint' (copies item.id to
activity_product.item_id), 'Item.activity_products' (copies item.id to
activity_product.item_id). If this is not the intention, consider if
these relationships should be linked with back_populates, or if
viewonly=True should be applied to one or more if they are read-only.

I have applied viewonly to activity_products__eager since it appears
to only be used as a performance enhancement and is read only.

The following warning is given when running migrations:

```
SAWarning: relationship 'Item.activity_products__eager' will copy column
item.id to column activity_product.item_id, which conflicts with
relationship(s): 'ActivityProduct.blueprint' (copies item.id to
activity_product.item_id), 'Item.activity_products' (copies item.id to
activity_product.item_id). If this is not the intention, consider if
these relationships should be linked with back_populates, or if
viewonly=True should be applied to one or more if they are read-only.
```

I have applied `viewonly` to `activity_products__eager` since it appears
to only be used as a performance enhancement and is read only.
@Kyria Kyria self-assigned this May 23, 2022
@Kyria
Copy link
Owner

Kyria commented May 23, 2022

yep this was done to reduce the number of query (and improve the performance) because it was a bit slow (due to the size of the tables). It's readonly, as the data itself is managed by the SDE, so it's fine.

@Kyria Kyria merged commit fcd3605 into Kyria:master May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants