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

👌 IMPROVE: Get session from backend in SqlaModelEntity #5199

Merged

Conversation

chrisjsewell
Copy link
Member

Replace get_scoped_session() with self.backend.get_session().
Note currently SqlaBackend.get_session simply calls
get_scoped_session(), so this does not change any logic.
But eventually SqlaBackend instances will manage their own session,
and get_scoped_session() will be removed.

Unverified

This user has not yet uploaded their public signing key.
Replace `get_scoped_session()` with `self.backend.get_session()`.
Note currently `SqlaBackend.get_session` simply calls
`get_scoped_session()`, so this does not change any logic.
But eventually `SqlaBackend` instances will manage their own session,
and `get_scoped_session()` will be removed.
@chrisjsewell
Copy link
Member Author

chrisjsewell commented Oct 26, 2021

Note, this does not remove all instances of get_scoped_session(); it is still used in DbModel.save and ModelWrapper etc (see #5172).
It is just an easy step in the right direction.

@codecov
Copy link

codecov bot commented Oct 26, 2021

Codecov Report

Merging #5199 (41cae11) into develop (6e272a3) will decrease coverage by 0.01%.
The diff coverage is 90.48%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #5199      +/-   ##
===========================================
- Coverage    81.00%   81.00%   -0.00%     
===========================================
  Files          535      535              
  Lines        37412    37402      -10     
===========================================
- Hits         30302    30293       -9     
+ Misses        7110     7109       -1     
Flag Coverage Δ
django 75.82% <4.77%> (+0.01%) ⬆️
sqlalchemy 74.92% <90.48%> (-<0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aiida/orm/implementation/sqlalchemy/computers.py 75.65% <50.00%> (-0.30%) ⬇️
aiida/orm/implementation/sqlalchemy/authinfos.py 88.89% <100.00%> (-0.20%) ⬇️
aiida/orm/implementation/sqlalchemy/comments.py 94.60% <100.00%> (-0.07%) ⬇️
aiida/orm/implementation/sqlalchemy/groups.py 86.64% <100.00%> (-0.34%) ⬇️
aiida/orm/implementation/sqlalchemy/logs.py 94.65% <100.00%> (-0.09%) ⬇️
aiida/orm/implementation/sqlalchemy/nodes.py 92.08% <100.00%> (-0.07%) ⬇️
aiida/transports/plugins/local.py 81.66% <0.00%> (+0.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6e272a3...41cae11. Read the comment docs.

@chrisjsewell chrisjsewell merged commit dfbd497 into aiidateam:develop Oct 26, 2021
@chrisjsewell chrisjsewell deleted the repplace-get-scoped-session branch October 26, 2021 05:06
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.

1 participant