8000 Merge branch 'main' into feature/add_ssl · psqlpy-python/psqlpy@eccdcb3 · GitHub
[go: up one dir, main page]

Skip to content

Commit eccdcb3

Browse files
authored
Merge branch 'main' into feature/add_ssl
2 parents 42ced7a + a4185e0 commit eccdcb3
Copy full SHA for eccdcb3

File tree

9 files changed

+47
-959
lines changed

9 files changed

+47
-959
lines changed

psqlpy-stress/dashboard.json

Lines changed: 0 additions & 771 deletions
This file was deleted.

psqlpy-stress/docker-compose.yaml

Lines changed: 0 additions & 33 deletions
This file was deleted.

psqlpy-stress/psqlpy_stress/api/piccolo.py

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,134 +4,120 @@
44
from piccolo.engine import engine_finder
55
from piccolo.query import OrderByRaw
66

7-
from psqlpy_stress.influx_db_helpers import write_timings_to_influx
87
from psqlpy_stress.models.piccolo import SomeBigTable, User
98
from psqlpy_stress.piccolo_conf import (
109
ASYNCPG_PICCOLO_ENGINE,
1110
PSQLPY_PICCOLO_ENGINE,
1211
)
13-
from psqlpy_stress.settings import DriversEnum
1412

1513

16-
@write_timings_to_influx(DriversEnum.PSQLPY)
1714
async def psqlpy_simple_transaction_select_piccolo(
1815
_request: web.Request,
1916
) -> web.Response:
2017
async with PSQLPY_PICCOLO_ENGINE.transaction():
2118
User._meta.db = PSQLPY_PICCOLO_ENGINE
22-
await User.select().order_by(OrderByRaw("random()")).run()
19+
await User.select().order_by(OrderByRaw("random()")).limit(10)
2320
return web.Response(status=200, text="Ok")
2421

2522

26-
@write_timings_to_influx(DriversEnum.ASYNCPG)
2723
async def asyncpg_simple_transaction_select_piccolo(
2824
_request: web.Request,
2925
) -> web.Response:
3026
async with ASYNCPG_PICCOLO_ENGINE.transaction():
3127
User._meta.db = ASYNCPG_PICCOLO_ENGINE
32-
await User.select().order_by(OrderByRaw("random()")).run()
28+
await User.select().order_by(OrderByRaw("random()")).limit(10)
3329
return web.Response(status=200, text="Ok")
3430

3531

36-
@write_timings_to_influx(DriversEnum.PSQLPY)
3732
async def psqlpy_simple_connection_select_piccolo(_request: web.Request) -> web.Response:
3833
User._meta.db = PSQLPY_PICCOLO_ENGINE
39-
await User.select().order_by(OrderByRaw("random()")).run()
34+
await User.select().order_by(OrderByRaw("random()")).limit(10)
4035
return web.Response(status=200, text="Ok")
4136

4237

43-
@write_timings_to_influx(DriversEnum.ASYNCPG)
4438
async def asyncpg_simple_connection_select_piccolo(
4539
_request: web.Request,
4640
) -> web.Response:
4741
User._meta.db = ASYNCPG_PICCOLO_ENGINE
48-
await User.select().order_by(OrderByRaw("random()")).run()
42+
await User.select().order_by(OrderByRaw("random()")).limit(10)
4943
return web.Response(status=200, text="Ok")
5044

5145

5246
# --------------------------------------------- Hard queries handlers starting here ---------------------------------------------
5347

5448

55-
@write_timings_to_influx(DriversEnum.PSQLPY)
5649
async def psqlpy_hard_transaction_select_piccolo(
5750
_request: web.Request,
5851
) -> web.Response:
5952
async with PSQLPY_PICCOLO_ENGINE.transaction():
6053
SomeBigTable._meta.db = PSQLPY_PICCOLO_ENGINE
61-
await SomeBigTable.select().order_by(OrderByRaw("random()")).run()
54+
await SomeBigTable.select().order_by(OrderByRaw("random()")).limit(10)
6255
return web.Response(status=200, text="Ok")
6356

6457

65-
@write_timings_to_influx(DriversEnum.ASYNCPG)
6658
async def asyncpg_hard_transaction_select_piccolo(
6759
_request: web.Request,
6860
) -> web.Response:
6961
engine_finder().set_engine(ASYNCPG_PICCOLO_ENGINE)
7062
async with ASYNCPG_PICCOLO_ENGINE.transaction():
7163
SomeBigTable._meta.db = ASYNCPG_PICCOLO_ENGINE
72-
await SomeBigTable.select().order_by(OrderByRaw("random()")).run()
64+
await SomeBigTable.select().order_by(OrderByRaw("random()")).limit(10)
7365
return web.Response(status=200, text="Ok")
7466

7567

76-
@write_timings_to_influx(DriversEnum.PSQLPY)
7768
async def psqlpy_hard_connection_select_piccolo(_request: web.Request) -> web.Response:
7869
SomeBigTable._meta.db = PSQLPY_PICCOLO_ENGINE
79-
await SomeBigTable.select().order_by(OrderByRaw("random()")).run()
70+
await SomeBigTable.select().order_by(OrderByRaw("random()")).limit(10)
8071
return web.Response(status=200, text="Ok")
8172

8273

83-
@write_timings_to_influx(DriversEnum.ASYNCPG)
8474
async def asyncpg_hard_connection_select_piccolo(
8575
_request: web.Request,
8676
) -> web.Response:
8777
SomeBigTable._meta.db = ASYNCPG_PICCOLO_ENGINE
88-
await SomeBigTable.select().order_by(OrderByRaw("random()")).run()
78+
await SomeBigTable.select().order_by(OrderByRaw("random()")).limit(10)
8979
return web.Response(status=200, text="Ok")
9080

9181

9282
# --------------------------------------------- Combined queries (select + insert) handlers starting here ---------------------------------------------
9383

9484

95-
@write_timings_to_influx(DriversEnum.PSQLPY)
9685
async def psqlpy_combined_transaction_query_piccolo(
9786
_request: web.Request,
9887
) -> web.Response:
9988
async with PSQLPY_PICCOLO_ENGINE.transaction():
10089
User._meta.db = PSQLPY_PICCOLO_ENGINE
101-
await User.insert(User(username=str(uuid.uuid4()))).run()
102-
await User.select().order_by(OrderByRaw("random()")).run()
90+
await User.insert(User(username=str(uuid.uuid4())))
91+
await User.select().order_by(OrderByRaw("random()")).limit(10)
10392
return web.Response(status=200, text="Ok")
10493

10594

106-
@write_timings_to_influx(DriversEnum.ASYNCPG)
10795
async def asyncpg_combined_transaction_query_piccolo(
10896
_request: web.Request,
10997
) -> web.Response:
11098
engine_finder().set_engine(ASYNCPG_PICCOLO_ENGINE)
11199
async with ASYNCPG_PICCOLO_ENGINE.transaction():
112100
User._meta.db = ASYNCPG_PICCOLO_ENGINE
113-
await User.insert(User(username=str(uuid.uuid4()))).run()
114-
await User.select().order_by(OrderByRaw("random()")).run()
101+
await User.insert(User(username=str(uuid.uuid4())))
102+
await User.select().order_by(OrderByRaw("random()")).limit(10)
115103
return web.Response(status=200, text="Ok")
116104

117105

118-
@write_timings_to_influx(DriversEnum.PSQLPY)
119106
async def psqlpy_combined_connection_query_piccolo(
120107
_request: web.Request,
121108
) -> web.Response:
122109
User._meta.db = PSQLPY_PICCOLO_ENGINE
123-
await User.insert(User(username=str(uuid.uuid4()))).run()
124-
await User.select().order_by(OrderByRaw("random()")).run()
110+
await User.insert(User(username=str(uuid.uuid4())))
111+
await User.select().order_by(OrderByRaw("random()")).limit(10)
125112
return web.Response(status=200, text="Ok")
126113

127114

128-
@write_timings_to_influx(DriversEnum.ASYNCPG)
129115
async def asyncpg_combined_connection_query_piccolo(
130116
_request: web.Request,
131117
) -> web.Response:
132118
User._meta.db = ASYNCPG_PICCOLO_ENGINE
133-
await User.insert(User(username=str(uuid.uuid4()))).run()
134-
await User.select().order_by(OrderByRaw("random()")).run()
119+
await User.insert(User(username=str(uuid.uuid4())))
120+
await User.select().order_by(OrderByRaw("random()")).limit(10)
135121
return web.Response(status=200, text="Ok")
136122

137123

0 commit comments

Comments
 (0)
0