Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from djangobench.utils import run_benchmark | ||
from raw_sql.models import OneField | ||
from django.db import connection | ||
|
||
def benchmark(): | ||
cursor = connection.cursor() | ||
cursor.execute("select field1 from raw_sql_onefield") | ||
list(cursor.fetchall()) | ||
|
||
def setup(): | ||
for i in range(0, 10): | ||
OneField(field1=i).save() | ||
|
||
run_benchmark( | ||
benchmark, | ||
setup=setup, | ||
meta={ | ||
'description': 'A test for stressing direct SQL performance', | ||
} | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from django.db import models | ||
|
||
class OneField(models.Model): | ||
field1 = models.CharField(max_length=100) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from djangobench.base_settings import * | ||
|
||
INSTALLED_APPS = ['raw_sql'] |