piccolo 1.13.1__py3-none-any.whl → 1.14.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- piccolo/__init__.py +1 -1
- piccolo/columns/base.py +3 -3
- piccolo/engine/base.py +7 -0
- piccolo/engine/postgres.py +7 -0
- piccolo/query/base.py +5 -14
- piccolo/query/methods/select.py +1 -1
- piccolo/querystring.py +1 -1
- {piccolo-1.13.1.dist-info → piccolo-1.14.0.dist-info}/METADATA +15 -15
- {piccolo-1.13.1.dist-info → piccolo-1.14.0.dist-info}/RECORD +13 -13
- {piccolo-1.13.1.dist-info → piccolo-1.14.0.dist-info}/WHEEL +1 -1
- {piccolo-1.13.1.dist-info → piccolo-1.14.0.dist-info}/LICENSE +0 -0
- {piccolo-1.13.1.dist-info → piccolo-1.14.0.dist-info}/entry_points.txt +0 -0
- {piccolo-1.13.1.dist-info → piccolo-1.14.0.dist-info}/top_level.txt +0 -0
piccolo/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__VERSION__ = "1.
|
1
|
+
__VERSION__ = "1.14.0"
|
piccolo/columns/base.py
CHANGED
@@ -250,11 +250,11 @@ class ColumnMeta:
|
|
250
250
|
|
251
251
|
if self.call_chain:
|
252
252
|
column_name = (
|
253
|
-
"
|
253
|
+
".".join(
|
254
254
|
t.cast(str, i._meta.db_column_name)
|
255
255
|
for i in self.call_chain
|
256
256
|
)
|
257
|
-
+ f"
|
257
|
+
+ f".{column_name}"
|
258
258
|
)
|
259
259
|
|
260
260
|
return column_name
|
@@ -291,7 +291,7 @@ class ColumnMeta:
|
|
291
291
|
'band$manager.name'
|
292
292
|
|
293
293
|
>>> Band.manager.name._meta.get_full_name(with_alias=True)
|
294
|
-
'band$manager.name AS "manager
|
294
|
+
'band$manager.name AS "manager.name"'
|
295
295
|
|
296
296
|
:param include_quotes:
|
297
297
|
If you're using the name in a SQL query, each component needs to be
|
piccolo/engine/base.py
CHANGED
@@ -132,6 +132,13 @@ class Engine(t.Generic[TransactionClass], metaclass=ABCMeta):
|
|
132
132
|
):
|
133
133
|
pass
|
134
134
|
|
135
|
+
def transform_response_to_dicts(self, results) -> t.List[t.Dict]:
|
136
|
+
"""
|
137
|
+
If the database adapter returns something other than a list of
|
138
|
+
dictionaries, it should perform the transformation here.
|
139
|
+
"""
|
140
|
+
return results
|
141
|
+
|
135
142
|
@abstractmethod
|
136
143
|
async def run_ddl(self, ddl: str, in_pool: bool = True):
|
137
144
|
pass
|
piccolo/engine/postgres.py
CHANGED
@@ -579,6 +579,13 @@ class PostgresEngine(Engine[PostgresTransaction]):
|
|
579
579
|
|
580
580
|
return response
|
581
581
|
|
582
|
+
def transform_response_to_dicts(self, results) -> t.List[t.Dict]:
|
583
|
+
"""
|
584
|
+
asyncpg returns a special Record object, so we need to convert it to
|
585
|
+
a dict.
|
586
|
+
"""
|
587
|
+
return [dict(i) for i in results]
|
588
|
+
|
582
589
|
def atomic(self) -> Atomic:
|
583
590
|
return Atomic(engine=self)
|
584
591
|
|
piccolo/query/base.py
CHANGED
@@ -45,20 +45,11 @@ class Query(t.Generic[TableInstance, QueryResponseType]):
|
|
45
45
|
raise ValueError("Engine isn't defined.")
|
46
46
|
|
47
47
|
async def _process_results(self, results) -> QueryResponseType:
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
# directly into zip without calling `values` on it. This can
|
54
|
-
# save us hundreds of microseconds, depending on the number of
|
55
|
-
# results.
|
56
|
-
raw = [dict(zip(keys, i)) for i in results]
|
57
|
-
else:
|
58
|
-
# SQLite returns a list of dictionaries.
|
59
|
-
raw = [dict(zip(keys, i.values())) for i in results]
|
60
|
-
else:
|
61
|
-
raw = []
|
48
|
+
raw = (
|
49
|
+
self.table._meta.db.transform_response_to_dicts(results)
|
50
|
+
if results
|
51
|
+
else []
|
52
|
+
)
|
62
53
|
|
63
54
|
if hasattr(self, "_raw_response_callback"):
|
64
55
|
self._raw_response_callback(raw)
|
piccolo/query/methods/select.py
CHANGED
@@ -574,7 +574,7 @@ class Select(Query[TableInstance, t.List[t.Dict[str, t.Any]]]):
|
|
574
574
|
query += "{}"
|
575
575
|
args.append(distinct.querystring)
|
576
576
|
|
577
|
-
columns_str = ", ".join("{}" for
|
577
|
+
columns_str = ", ".join("{}" for _ in select_strings)
|
578
578
|
query += f" {columns_str} FROM {self.table._meta.get_formatted_tablename()}" # noqa: E501
|
579
579
|
args.extend(select_strings)
|
580
580
|
|
piccolo/querystring.py
CHANGED
@@ -246,7 +246,7 @@ class QueryString(Selectable):
|
|
246
246
|
self, engine_type: str, with_alias: bool = True
|
247
247
|
) -> QueryString:
|
248
248
|
if with_alias and self._alias:
|
249
|
-
return QueryString("{} AS " + self._alias, self)
|
249
|
+
return QueryString("{} AS " + f'"{self._alias}"', self)
|
250
250
|
else:
|
251
251
|
return self
|
252
252
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: piccolo
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.14.0
|
4
4
|
Summary: A fast, user friendly ORM and query builder which supports asyncio.
|
5
5
|
Home-page: https://github.com/piccolo-orm/piccolo
|
6
6
|
Author: Daniel Townsend
|
@@ -25,28 +25,28 @@ Requires-Python: >=3.8.0
|
|
25
25
|
Description-Content-Type: text/markdown
|
26
26
|
License-File: LICENSE
|
27
27
|
Requires-Dist: black
|
28
|
-
Requires-Dist: colorama >=0.4.0
|
29
|
-
Requires-Dist: Jinja2 >=2.11.0
|
30
|
-
Requires-Dist: targ >=0.3.7
|
31
|
-
Requires-Dist: inflection >=0.5.1
|
32
|
-
Requires-Dist: typing-extensions >=4.3.0
|
33
|
-
Requires-Dist: pydantic[email] ==2.*
|
28
|
+
Requires-Dist: colorama (>=0.4.0)
|
29
|
+
Requires-Dist: Jinja2 (>=2.11.0)
|
30
|
+
Requires-Dist: targ (>=0.3.7)
|
31
|
+
Requires-Dist: inflection (>=0.5.1)
|
32
|
+
Requires-Dist: typing-extensions (>=4.3.0)
|
33
|
+
Requires-Dist: pydantic[email] (==2.*)
|
34
34
|
Provides-Extra: all
|
35
|
-
Requires-Dist: orjson >=3.5.1 ; extra == 'all'
|
35
|
+
Requires-Dist: orjson (>=3.5.1) ; extra == 'all'
|
36
36
|
Requires-Dist: ipython ; extra == 'all'
|
37
|
-
Requires-Dist: asyncpg >=0.21.0 ; extra == 'all'
|
38
|
-
Requires-Dist: aiosqlite >=0.16.0 ; extra == 'all'
|
39
|
-
Requires-Dist: uvloop >=0.12.0 ; (sys_platform != "win32") and extra == 'all'
|
37
|
+
Requires-Dist: asyncpg (>=0.21.0) ; extra == 'all'
|
38
|
+
Requires-Dist: aiosqlite (>=0.16.0) ; extra == 'all'
|
39
|
+
Requires-Dist: uvloop (>=0.12.0) ; (sys_platform != "win32") and extra == 'all'
|
40
40
|
Provides-Extra: orjson
|
41
|
-
Requires-Dist: orjson >=3.5.1 ; extra == 'orjson'
|
41
|
+
Requires-Dist: orjson (>=3.5.1) ; extra == 'orjson'
|
42
42
|
Provides-Extra: playground
|
43
43
|
Requires-Dist: ipython ; extra == 'playground'
|
44
44
|
Provides-Extra: postgres
|
45
|
-
Requires-Dist: asyncpg >=0.21.0 ; extra == 'postgres'
|
45
|
+
Requires-Dist: asyncpg (>=0.21.0) ; extra == 'postgres'
|
46
46
|
Provides-Extra: sqlite
|
47
|
-
Requires-Dist: aiosqlite >=0.16.0 ; extra == 'sqlite'
|
47
|
+
Requires-Dist: aiosqlite (>=0.16.0) ; extra == 'sqlite'
|
48
48
|
Provides-Extra: uvloop
|
49
|
-
Requires-Dist: uvloop >=0.12.0 ; (sys_platform != "win32") and extra == 'uvloop'
|
49
|
+
Requires-Dist: uvloop (>=0.12.0) ; (sys_platform != "win32") and extra == 'uvloop'
|
50
50
|
|
51
51
|

|
52
52
|
|
@@ -1,8 +1,8 @@
|
|
1
|
-
piccolo/__init__.py,sha256=
|
1
|
+
piccolo/__init__.py,sha256=vQd7XyktulZvg_rtkaOpG-2W02Gb_wFd8aev4i-MHeA,23
|
2
2
|
piccolo/custom_types.py,sha256=7HMQAze-5mieNLfbQ5QgbRQgR2abR7ol0qehv2SqROY,604
|
3
3
|
piccolo/main.py,sha256=1VsFV67FWTUikPTysp64Fmgd9QBVa_9wcwKfwj2UCEA,5117
|
4
4
|
piccolo/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
piccolo/querystring.py,sha256=
|
5
|
+
piccolo/querystring.py,sha256=yZdURtiVSlxkkEVJoFKAmL2OfNxrUr8xfsfuBBB7IuY,9662
|
6
6
|
piccolo/schema.py,sha256=qNNy4tG_HqnXR9t3hHMgYXtGxHabwQAhUpc6RKLJ_gE,7960
|
7
7
|
piccolo/table.py,sha256=IfXT9rtm1sBN-u_A8-_0gj6fJf3_RGSPtWMJa-FX9jw,49569
|
8
8
|
piccolo/table_reflection.py,sha256=jrN1nHerDJ4tU09GtNN3hz7ap-7rXnSUjljFO6LB2H0,7094
|
@@ -115,7 +115,7 @@ piccolo/apps/user/piccolo_migrations/2020-06-11T21-38-55.py,sha256=JG_LFPrEljnSE
|
|
115
115
|
piccolo/apps/user/piccolo_migrations/2021-04-30T16-14-15.py,sha256=Y_Dj4ROSxjnPsRDqcnpWeyk8UpF8c80T08_O2uq-GoA,1219
|
116
116
|
piccolo/apps/user/piccolo_migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
117
117
|
piccolo/columns/__init__.py,sha256=OYhO_n9anMiU9nL-K6ATq9FhAtm8RyMpqYQ7fTVbhxI,1120
|
118
|
-
piccolo/columns/base.py,sha256=
|
118
|
+
piccolo/columns/base.py,sha256=_bg9yMWjMwE76Z7RDqi9iYSmtRuFx5bkx9uYJsFHKjQ,32487
|
119
119
|
piccolo/columns/choices.py,sha256=-HNQuk9vMmVZIPZ5PMeXGTfr23o4nzKPSAkvcG1k0y8,723
|
120
120
|
piccolo/columns/column_types.py,sha256=X_ZsA0C4WBNVonV2OsizRdt1osMshgtQ3Ob6JN-amfg,83485
|
121
121
|
piccolo/columns/combination.py,sha256=vMXC2dfY7pvnCFhsT71XFVyb4gdQzfRsCMaiduu04Ss,6900
|
@@ -139,14 +139,14 @@ piccolo/columns/operators/string.py,sha256=M5ifxHP-ttJaE_wYCl23W5sJof4i5S5_QDIOv
|
|
139
139
|
piccolo/conf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
140
140
|
piccolo/conf/apps.py,sha256=AlgOM2ePl9NQjME5AQxcZ5RbuQpjRywFCj5uHUsCIZU,19040
|
141
141
|
piccolo/engine/__init__.py,sha256=Z0QR5NAA9jTFenY7pEJv1C8jZXBaFZojBUR3z3nx1cw,283
|
142
|
-
piccolo/engine/base.py,sha256=
|
142
|
+
piccolo/engine/base.py,sha256=4NISWRuvgp5ShqJbOEK6g8ok8Ijqtp2gzuM9J6o_wSU,6444
|
143
143
|
piccolo/engine/cockroach.py,sha256=gGnihplotMZMWqHwRnZYnnbKU3jFrwttwOlNtktoeLE,1522
|
144
144
|
piccolo/engine/exceptions.py,sha256=X8xZiTF-L9PIqFT-KDXnv1jFIIOZMF8fYK692chttJE,44
|
145
145
|
piccolo/engine/finder.py,sha256=GjzBNtzRzH79fjtRn7OI3nZiOXE8JfoQWAvHVPrPNx4,507
|
146
|
-
piccolo/engine/postgres.py,sha256=
|
146
|
+
piccolo/engine/postgres.py,sha256=DekL3KafCdzSAEQ6_EgOiUB1ERXh2xpePYwI9QvmN-c,18955
|
147
147
|
piccolo/engine/sqlite.py,sha256=KwJc3UttBP_8qSREbLJshqEfROF17ENf0Ju9BwI5_so,25236
|
148
148
|
piccolo/query/__init__.py,sha256=bcsMV4813rMRAIqGv4DxI4eyO4FmpXkDv9dfTk5pt3A,699
|
149
|
-
piccolo/query/base.py,sha256=
|
149
|
+
piccolo/query/base.py,sha256=2eyfgqdzl5bKQBRpmxil_HoXpCEDGGrh84q62ZmfBNk,14680
|
150
150
|
piccolo/query/mixins.py,sha256=EFEFb9It4y1mR6_JXLn139h5M9KgeP750STYy5M4MLs,21951
|
151
151
|
piccolo/query/proxy.py,sha256=Yq4jNc7IWJvdeO3u7_7iPyRy2WhVj8KsIUcIYHBIi9Q,1839
|
152
152
|
piccolo/query/functions/__init__.py,sha256=pZkzOIh7Sg9HPNOeegOwAS46Oxt31ATlSVmwn-lxCbc,605
|
@@ -169,7 +169,7 @@ piccolo/query/methods/insert.py,sha256=ssLJ_wn08KnOwwr7t-VILyn1P4hrvM63CfPIcAJWT
|
|
169
169
|
piccolo/query/methods/objects.py,sha256=iahDUziUtlx7pJ2uBAhdm3hCTmg2AS9C8cal1my5KR0,11705
|
170
170
|
piccolo/query/methods/raw.py,sha256=VhYpCB52mZk4zqFTsqK5CHKTDGskUjISXTBV7UjohmA,600
|
171
171
|
piccolo/query/methods/refresh.py,sha256=P1Eo_HYU_L7kcGM_cvDDgyLi1boCXY7Pc4tv_eDAzvc,2769
|
172
|
-
piccolo/query/methods/select.py,sha256=
|
172
|
+
piccolo/query/methods/select.py,sha256=KDbLRkADM9xNQsoNYN_eNSwapFACQCUNiCvw0B5tmko,21315
|
173
173
|
piccolo/query/methods/table_exists.py,sha256=0yb3n6Jd2ovSBWlZ-gl00K4E7Jnbj7J8qAAX5d7hvNk,1259
|
174
174
|
piccolo/query/methods/update.py,sha256=LfWqIXEl1aecc0rkVssTFmwyD6wXGhlKcTrUVhtlEsw,3705
|
175
175
|
piccolo/testing/__init__.py,sha256=pRFSqRInfx95AakOq54atmvqoB-ue073q2aR8u8zR40,83
|
@@ -365,9 +365,9 @@ tests/utils/test_sql_values.py,sha256=vzxRmy16FfLZPH-sAQexBvsF9MXB8n4smr14qoEOS5
|
|
365
365
|
tests/utils/test_sync.py,sha256=9ytVo56y2vPQePvTeIi9lHIouEhWJbodl1TmzkGFrSo,799
|
366
366
|
tests/utils/test_table_reflection.py,sha256=SIzuat-IpcVj1GCFyOWKShI8YkhdOPPFH7qVrvfyPNE,3794
|
367
367
|
tests/utils/test_warnings.py,sha256=NvSC_cvJ6uZcwAGf1m-hLzETXCqprXELL8zg3TNLVMw,269
|
368
|
-
piccolo-1.
|
369
|
-
piccolo-1.
|
370
|
-
piccolo-1.
|
371
|
-
piccolo-1.
|
372
|
-
piccolo-1.
|
373
|
-
piccolo-1.
|
368
|
+
piccolo-1.14.0.dist-info/LICENSE,sha256=zFIpi-16uIJ420UMIG75NU0JbDBykvrdnXcj5U_EYBI,1059
|
369
|
+
piccolo-1.14.0.dist-info/METADATA,sha256=4rDBz-Wbqp-MdHwcZd3LaxJToiNqW5hVFQkCOkCD8LU,5178
|
370
|
+
piccolo-1.14.0.dist-info/WHEEL,sha256=rWxmBtp7hEUqVLOnTaDOPpR-cZpCDkzhhcBce-Zyd5k,91
|
371
|
+
piccolo-1.14.0.dist-info/entry_points.txt,sha256=SJPHET4Fi1bN5F3WqcKkv9SClK3_F1I7m4eQjk6AFh0,46
|
372
|
+
piccolo-1.14.0.dist-info/top_level.txt,sha256=-SR74VGbk43VoPy1HH-mHm97yoGukLK87HE5kdBW6qM,24
|
373
|
+
piccolo-1.14.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|