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

Address warnings emitted after SQLAlchemy upgrade to 1.4 #523

Closed
grahamalama opened this issue Jan 27, 2023 · 0 comments · Fixed by #553
Closed

Address warnings emitted after SQLAlchemy upgrade to 1.4 #523

grahamalama opened this issue Jan 27, 2023 · 0 comments · Fixed by #553

Comments

@grahamalama
Copy link
Contributor

Since upgrading SQLAlchemy to 1.4 (#502), it has started emitting some warnings:

tests/unit/test_acoustic_service.py::test_ctms_to_acoustic_no_product
  /Users/gbeckley/github/mozilla-it/ctms-api/migrations/env.py:68: RemovedIn20Warning: Deprecated API features detected! These feature(s) are not compatible with SQLAlchemy 2.0. To prevent incompatible upgrades prior to updating applications, ensure requirements files are pinned to "sqlalchemy<2.0". Set environment variable SQLALCHEMY_WARN_20=1 to show all deprecation warnings.  Set environment variable SQLALCHEMY_SILENCE_UBER_WARNING=1 to silence this message. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
    with connectable.connect() as connection:

tests/unit/test_acoustic_service.py::test_ctms_to_acoustic_no_product
  /Users/gbeckley/github/mozilla-it/ctms-api/ctms/crud.py:414: SAWarning: relationship 'Email.stripe_customer' will copy column emails.email_id to column fxa.email_id, which conflicts with relationship(s): 'Email.fxa' (copies emails.email_id to fxa.email_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. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="fxa"' to the 'Email.stripe_customer' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
    db_email = Email(**email.dict())

tests/unit/test_acoustic_service.py::test_ctms_to_acoustic_no_product
  /Users/gbeckley/github/mozilla-it/ctms-api/ctms/crud.py:414: SAWarning: relationship 'FirefoxAccount.email' will copy column emails.email_id to column fxa.email_id, which conflicts with relationship(s): 'Email.stripe_customer' (copies emails.email_id to fxa.email_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. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="stripe_customer"' to the 'FirefoxAccount.email' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
    db_email = Email(**email.dict())

tests/unit/test_acoustic_service.py::test_ctms_to_acoustic_no_product
  /Users/gbeckley/github/mozilla-it/ctms-api/ctms/crud.py:414: SAWarning: relationship 'StripeCustomer.email' will copy column emails.email_id to column fxa.email_id, which conflicts with relationship(s): 'Email.fxa' (copies emails.email_id to fxa.email_id), 'FirefoxAccount.email' (copies emails.email_id to fxa.email_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. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="email,fxa"' to the 'StripeCustomer.email' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
    db_email = Email(**email.dict())

We should fix the issues as outlined in these warnings.

leplatrem added a commit that referenced this issue Mar 8, 2023
* Remove backref overlaps warnings

* Fix alembic engine warning

* Do not use string for loads

* Load relationships using class attributes

* Remove warnings from migration tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant