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

db: add sqlalchemy 2.0 support #1317

Merged
merged 17 commits into from
Aug 7, 2023

Conversation

tobias-urdin
Copy link
Contributor

@tobias-urdin tobias-urdin commented Aug 1, 2023

This adds support for SQLAlchemy 2.0 but does not solve the removal of autocommit which will need to be handled in the future.

@tobias-urdin tobias-urdin force-pushed the sqlalchemy2 branch 30 times, most recently from 78a7f5c to cf12986 Compare August 2, 2023 13:47
@tobias-urdin tobias-urdin changed the title dnm: debug sqlalchemy 2.0 db: add sqlalchemy 2.0 support Aug 2, 2023
@tobias-urdin tobias-urdin force-pushed the sqlalchemy2 branch 2 times, most recently from ad29841 to 15fcaee Compare August 2, 2023 18:42
@tobias-urdin tobias-urdin mentioned this pull request Aug 2, 2023
Copy link
Contributor

@stephenfin stephenfin left a comment

Choose a reason for hiding this comment

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

Only spotted one potential issue. The rest looks good though we'll surely spot other issues when we resolve the autocommit thing and use SQLAlchemy 2.x (and oslo.db 13.x).

Out of curiosity, would it be worth enabling warnings in our test like we've done for most OpenStack projects?

gnocchi/indexer/sqlalchemy.py Show resolved Hide resolved
gnocchi/indexer/sqlalchemy.py Outdated Show resolved Hide resolved
@tobias-urdin
Copy link
Contributor Author

Only spotted one potential issue. The rest looks good though we'll surely spot other issues when we resolve the autocommit thing and use SQLAlchemy 2.x (and oslo.db 13.x).

Out of curiosity, would it be worth enabling warnings in our test like we've done for most OpenStack projects?

Thanks, yeah the autocommit part will really suck when it hits there is no real control of the transactions so more cleanup required there, the testing right now actually uses SQAlchemy 2.x and newer oslo.db already because we have unpinned dependencies that is not restricted by any upper-constraints.

I did look into enabling warnings with a warnings fixtures to the tests, used it while doing this work but didn't get any noticeable warnings except for the autocommit IIRC.

I opted for unpinning SQLAlchemy pinning and instead add a separate SQLAlchemy 1.4 job to make sure we don't break >=1.4<2 users.

this was introduced in 1.4 and it's our minimum
now so we can drop our compat code.
@stephenfin
Copy link
Contributor

Only spotted one potential issue. The rest looks good though we'll surely spot other issues when we resolve the autocommit thing and use SQLAlchemy 2.x (and oslo.db 13.x).
Out of curiosity, would it be worth enabling warnings in our test like we've done for most OpenStack projects?

Thanks, yeah the autocommit part will really suck when it hits there is no real control of the transactions so more cleanup required there, the testing right now actually uses SQAlchemy 2.x and newer oslo.db already because we have unpinned dependencies that is not restricted by any upper-constraints.

Oh really? I wonder how it's working though since autocommit isn't available in SQLAlchemy 2.x (at least outside of driver-level implementations). Weird.

I did look into enabling warnings with a warnings fixtures to the tests, used it while doing this work but didn't get any noticeable warnings except for the autocommit IIRC.

I opted for unpinning SQLAlchemy pinning and instead add a separate SQLAlchemy 1.4 job to make sure we don't break >=1.4<2 users.

Sounds good.

@tobias-urdin
Copy link
Contributor Author

Only spotted one potential issue. The rest looks good though we'll surely spot other issues when we resolve the autocommit thing and use SQLAlchemy 2.x (and oslo.db 13.x).
Out of curiosity, would it be worth enabling warnings in our test like we've done for most OpenStack projects?

Thanks, yeah the autocommit part will really suck when it hits there is no real control of the transactions so more cleanup required there, the testing right now actually uses SQAlchemy 2.x and newer oslo.db already because we have unpinned dependencies that is not restricted by any upper-constraints.

Oh really? I wonder how it's working though since autocommit isn't available in SQLAlchemy 2.x (at least outside of driver-level implementations). Weird.

I wish I had an answer for that but really I'm just glad it even works, I'm hoping nothing major is overlooked and that it actually works as well, it's still unreleased code so atleast not a catastrophe if this were to break someones CI.

I did look into enabling warnings with a warnings fixtures to the tests, used it while doing this work but didn't get any noticeable warnings except for the autocommit IIRC.
I opted for unpinning SQLAlchemy pinning and instead add a separate SQLAlchemy 1.4 job to make sure we don't break >=1.4<2 users.

Sounds good.

Do you have any other feedback for this or do you approve?

@stephenfin
Copy link
Contributor

Nope, no other feedback. This looks good to me as-is now.

@tobias-urdin tobias-urdin merged commit 7248016 into gnocchixyz:master Aug 7, 2023
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants