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

Support SQLAlchemy 2.0 with sqlalchemy-oso #1739

Merged
merged 14 commits into from
Jun 13, 2024
Merged

Support SQLAlchemy 2.0 with sqlalchemy-oso #1739

merged 14 commits into from
Jun 13, 2024

Conversation

samscott89
Copy link
Member

Adds support for sqlalchemy 2.0

@samscott89 samscott89 requested a review from gj June 11, 2024 21:25
Copy link
Member

Choose a reason for hiding this comment

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

Are these changes intended to ship?

Copy link
Member Author

Choose a reason for hiding this comment

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

Pinning Rust: yes, the other ones no

@@ -118,7 +118,6 @@ def test_get_column_entities(stmt, o):
(select(A), set()),
(select(A).options(joinedload(A.bs)), {B}),
(select(A).options(joinedload(A.bs).joinedload(B.cs)), {B, C}),
(select(A).options(Load(A).joinedload("bs")), {B}),
Copy link
Member

Choose a reason for hiding this comment

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

Why'd this one go?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is an invalid way of calling it in 2.0

Comment on lines +624 to +627
if USING_SQLAlchemy_v2_0:
tables = "tags, post_tags"
else:
tables = "post_tags, tags"
Copy link
Member

Choose a reason for hiding this comment

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

what in the world– why does this order matter???

Copy link
Member Author

Choose a reason for hiding this comment

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

It matters because we do a string comparison of the SQL we get back. SQLAlchemy 2.0 reordered these a little. We have this pattern elsewhere.

Would be nice if we had snapshots like with insta!

@samscott89 samscott89 merged commit d57c4cc into main Jun 13, 2024
18 of 21 checks passed
@samscott89 samscott89 deleted the sam/sqlalchemy_v2 branch June 13, 2024 19:55
@github-actions github-actions bot locked and limited conversation to collaborators Jun 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants