-
-
Notifications
You must be signed in to change notification settings - Fork 81
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(client): add transaction isolation level #878
base: main
Are you sure you want to change the base?
Conversation
7c96c66
to
875bb3d
Compare
41b8671
to
d373351
Compare
e3f59f6
to
18b364c
Compare
databases/tests/test_transactions.py
Outdated
# TODO: remove after issue will be resolved | ||
@pytest.mark.skipif(CURRENT_DATABASE in ['mysql', 'mariadb'], reason='https://github.com/prisma/prisma/issues/22890') | ||
async def test_isolation_level( | ||
client: Prisma, raw_queries: RawQueries, input_level: prisma.TransactionIsolationLevel, expected_level: str | ||
) -> None: | ||
"""A transaction isolation level is set correctly""" | ||
async with client.tx(isolation_level=input_level) as tx: | ||
results = await tx.query_raw(raw_queries.select_tx_isolation) | ||
|
||
assert len(results) == 1 | ||
|
||
row = results[0] | ||
assert any(row) | ||
|
||
level = next(iter(row.values())) | ||
# The result can depends on the database, so we do upper() and replace() | ||
level = str(level).upper().replace(' ', '_').replace('-', '_') | ||
assert level == expected_level |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RobertCraigie I updated the tests and found here a bug in Prisma 😅
P.S. Look please at mypy (3.11) step why it doesn't pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wow, thanks for reporting that!
The mypy failure is unrelated to your PR, I'll look into fixing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you rebase against main, the mypy job should pass now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll update docs, then wait for a response from the Prisma team, and if bug will be confirmed, then PR will be ready to final review 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll update docs, then wait for a response from the Prisma team, and if bug will be confirmed, then PR will be ready to final review 🎉
Answer: prisma/prisma#22890 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of course mysql doesn't even have a way to query that 🤦
I think it would be fine to just skip the tests for mysql if you haven't already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't know that...
It marked with skipif.
4991b5a
to
ac76cbb
Compare
68fa3d7
to
ef194c1
Compare
69cc396
to
b31265b
Compare
This will be helpful for transaction isolation levels support #878
This will be helpful for transaction isolation levels support #878
This will be helpful for transaction isolation levels support #878
This will be helpful for transaction isolation levels support #878
This will be helpful for transaction isolation levels support #878
This will be helpful for transaction isolation levels support #878
This will be helpful for transaction isolation levels support #878
Change Summary
Add support for interactive transactions with an isolation level.
Closes #463.
Checklist
Agreement
By submitting this pull request, I confirm that you can use, modify, copy and redistribute this contribution, under the terms of your choice.