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

feat: SQLAlchemy 2.0 support #368

Merged
merged 12 commits into from
May 14, 2023
Merged

feat: SQLAlchemy 2.0 support #368

merged 12 commits into from
May 14, 2023

Conversation

erikwrede
Copy link
Member

@erikwrede erikwrede commented Dec 4, 2022

SQLAlchemy 2.0 is coming soon. This PR is going to collect all of the necessary changes to support it.

@erikwrede erikwrede changed the title Draft: featSQLAlchemy 2.0 Draft: featSQLAlchemy 2.0 support Dec 4, 2022
@codecov
Copy link

codecov bot commented Dec 4, 2022

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01 ⚠️

Comparison is base (882205d) 96.39% compared to head (a0abf8a) 96.39%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #368      +/-   ##
==========================================
- Coverage   96.39%   96.39%   -0.01%     
==========================================
  Files           9        9              
  Lines         916      915       -1     
==========================================
- Hits          883      882       -1     
  Misses         33       33              
Impacted Files Coverage Δ
graphene_sqlalchemy/batching.py 95.45% <100.00%> (+0.10%) ⬆️
graphene_sqlalchemy/utils.py 96.03% <100.00%> (-0.07%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@erikwrede erikwrede changed the title Draft: featSQLAlchemy 2.0 support feat: SQLAlchemy 2.0 support Dec 4, 2022
@erikwrede erikwrede marked this pull request as ready for review January 2, 2023 14:27
@erikwrede
Copy link
Member Author

Some Exception ignored errors have appeared on 2.0:

Exception ignored in: <function _ConnectionRecord.checkout.<locals>.<lambda> at 0x11159d7a0>
Traceback (most recent call last):
  File "/Users/erik/dev/graphene-sqlalchemy/venv/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 734, in <lambda>
    if _finalize_fairy is not None
  File "/Users/erik/dev/graphene-sqlalchemy/venv/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 1030, in _finalize_fairy
    fairy.dbapi_connection = fairy._connection_record = None  # type: ignore
AttributeError: 'NoneType' object has no attribute 'dbapi_connection'

These seem to be related to the pytest fixtures, not the actual test cases. I haven't been able to identify a cause so far.

Copy link
Contributor

@jendrikjoe jendrikjoe left a comment

Choose a reason for hiding this comment

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

Rest seems great to me 👍

not SQL_VERSION_HIGHER_EQUAL_THAN_1_4,
reason="SQLAlchemy <1.4 does not support this",
)
def test_should_columproperty_convert_sqa_20():
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: You could hand the select function and parametrize the test depending on the SQL version 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

Good Idea!

graphene_sqlalchemy/tests/models_batching.py Outdated Show resolved Hide resolved
@pappasam
Copy link

@erikwrede just checking in to see if there's any help you need here to get this to the finish line? I'm not sure if this is paused because of some other piece of dependent work, but I'm very excited to use sqlalchemy 2.0 in my applications and this (AFAIK) is my final blocker.

@erikwrede
Copy link
Member Author

@pappasam on this branch, all tests are passing on 2.0. Fixing the review comments is still on my list and will be done soon. You can already start testing by installing this branch via pip. Async sessions are also supported already. Would appreciate any feedback! :)

@pappasam
Copy link

@erikwrede I can confirm that this branch works for me! No issues I can find on my end; I'm very much looking forward to this making it into a beta release

@budroco
Copy link

budroco commented Apr 11, 2023

How's it going? I use sqlalchemy 2 and it would be nice to have an official version of this.

FWIW, with this branch at least the example in the readme works. In pipenv it can be installed with:

pipenv install "git+https://github.com/graphql-python/[email protected]#egg=graphene-sqlalchemy"

@erikwrede erikwrede merged commit d0668cc into master May 14, 2023
18 of 19 checks passed
@budroco
Copy link

budroco commented May 15, 2023

Awesome, thank you!

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.

None yet

4 participants