Created
December 21, 2019 20:21
-
-
Save filipeximenes/58ea0267bbb78a10c92e35b43274b5e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import transaction, connection | |
from events.models import Event | |
def count_events(): | |
with transaction.atomic(): | |
print(Event.objects.count()) | |
input() | |
print(Event.objects.count()) | |
def insert_event(): | |
Event.objects.create(name="test") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import transaction, connection | |
from events.models import Event | |
def count_events_repeatable(): | |
with transaction.atomic(): | |
cursor = connection.cursor() | |
cursor.execute("SET TRANSACTION ISOLATION LEVEL REPEATABLE READ") | |
print(Event.objects.count()) | |
input() | |
print(Event.objects.count()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment