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

build(python): add support for SQLAlchemy 1.4 (#234) #234

Merged
merged 3 commits into from
Jul 8, 2024

Conversation

mdonadoni
Copy link
Member

@mdonadoni mdonadoni commented Mar 22, 2024

Closes #228

Copy link

codecov bot commented Mar 22, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 74.47%. Comparing base (f418dfb) to head (847eeb0).
Report is 14 commits behind head on master.

Files with missing lines Patch % Lines
reana_db/version.py 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #234      +/-   ##
==========================================
- Coverage   74.50%   74.47%   -0.03%     
==========================================
  Files           7        7              
  Lines         902      901       -1     
==========================================
- Hits          672      671       -1     
  Misses        230      230              
Files with missing lines Coverage Δ
reana_db/models.py 90.32% <100.00%> (-0.02%) ⬇️
reana_db/version.py 0.00% <0.00%> (ø)

@mdonadoni
Copy link
Member Author

New warnings:

SAWarning: TypeDecorator EncryptedType() will not produce a cache key because the cache_ok attribute is not set to True. This can have significant performance implications including some performance degradations in comparison to prior SQLAlchemy versions. Set this attribute to True if this type object's state is safe to use in a cache key, or False to disable this warning. (Background on this error at: https://sqlalche.me/e/14/cprf)

This can be partially fixed by changing EncryptedType (deprecated) into StringEncryptedType (note that a migration script would be needed), but some of the warnings are coming from some of invenio's dependencies.

I have not seen lower performance locally in any case.

mdonadoni added a commit to mdonadoni/reana-db that referenced this pull request Mar 25, 2024
Fix SQLAlchemy warning reporting conflicting relationships:

```
SAWarning: relationship 'User.workflow' will copy column user_.id_ to
column workflow.owner_id, which conflicts with relationship(s):
'User.workflows' (copies user_.id_ to workflow.owner_id),
'Workflow.user_' (copies user_.id_ to workflow.owner_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="user_,workflows"' to
the 'User.workflow' relationship. (Background on this error at:
https://sqlalche.me/e/14/qzyx)
```
@mdonadoni mdonadoni marked this pull request as ready for review May 29, 2024 09:26
Copy link
Member

@tiborsimko tiborsimko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well (using lower boundary).

Please verify that the relationship backref change does not require any alembic upgrade recipe. (Wondering whether the index key names could have changed or some such?)

Fix SQLAlchemy warning reporting conflicting relationships:

```
SAWarning: relationship 'User.workflow' will copy column user_.id_ to
column workflow.owner_id, which conflicts with relationship(s):
'User.workflows' (copies user_.id_ to workflow.owner_id),
'Workflow.user_' (copies user_.id_ to workflow.owner_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="user_,workflows"' to
the 'User.workflow' relationship. (Background on this error at:
https://sqlalche.me/e/14/qzyx)
```
@mdonadoni
Copy link
Member Author

Please verify that the relationship backref change does not require any alembic upgrade recipe. (Wondering whether the index key names could have changed or some such?)

I have double checked this and autogenerating a new alembic recipe results in empty downgrade/upgrade methods. Indexes should not be affected by these changes.

@mdonadoni mdonadoni merged commit 847eeb0 into reanahub:master Jul 8, 2024
14 checks passed
@mdonadoni mdonadoni deleted the sqlalchemy-1.4 branch July 17, 2024 12:20
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 this pull request may close these issues.

build(python): update SQLAlchemy to newer version
2 participants