piccolo 1.9.0__py3-none-any.whl → 1.10.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/apps/fixtures/commands/load.py +1 -1
- piccolo/apps/migrations/auto/__init__.py +8 -0
- piccolo/apps/migrations/auto/migration_manager.py +2 -1
- piccolo/apps/migrations/commands/backwards.py +3 -1
- piccolo/apps/migrations/commands/base.py +1 -1
- piccolo/apps/migrations/commands/check.py +1 -1
- piccolo/apps/migrations/commands/clean.py +1 -1
- piccolo/apps/migrations/commands/forwards.py +3 -1
- piccolo/apps/migrations/commands/new.py +4 -2
- piccolo/apps/schema/commands/generate.py +2 -2
- piccolo/apps/shell/commands/run.py +1 -1
- piccolo/columns/column_types.py +28 -4
- piccolo/columns/defaults/base.py +1 -1
- piccolo/columns/defaults/date.py +9 -1
- piccolo/columns/defaults/interval.py +1 -0
- piccolo/columns/defaults/time.py +9 -1
- piccolo/columns/defaults/timestamp.py +1 -0
- piccolo/columns/defaults/uuid.py +1 -1
- piccolo/columns/m2m.py +7 -7
- piccolo/columns/operators/comparison.py +4 -0
- piccolo/conf/apps.py +9 -4
- piccolo/engine/base.py +69 -20
- piccolo/engine/cockroach.py +2 -3
- piccolo/engine/postgres.py +33 -19
- piccolo/engine/sqlite.py +27 -22
- piccolo/query/methods/create_index.py +1 -1
- piccolo/query/methods/drop_index.py +1 -1
- piccolo/query/methods/objects.py +7 -7
- piccolo/query/methods/select.py +13 -7
- piccolo/query/mixins.py +3 -10
- piccolo/schema.py +18 -11
- piccolo/table.py +22 -21
- piccolo/utils/encoding.py +5 -3
- {piccolo-1.9.0.dist-info → piccolo-1.10.0.dist-info}/METADATA +1 -1
- {piccolo-1.9.0.dist-info → piccolo-1.10.0.dist-info}/RECORD +47 -47
- tests/apps/migrations/auto/integration/test_migrations.py +1 -1
- tests/columns/test_array.py +28 -0
- tests/conf/test_apps.py +1 -1
- tests/engine/test_nested_transaction.py +2 -0
- tests/engine/test_transaction.py +1 -2
- tests/table/test_indexes.py +4 -2
- tests/utils/test_pydantic.py +70 -29
- {piccolo-1.9.0.dist-info → piccolo-1.10.0.dist-info}/LICENSE +0 -0
- {piccolo-1.9.0.dist-info → piccolo-1.10.0.dist-info}/WHEEL +0 -0
- {piccolo-1.9.0.dist-info → piccolo-1.10.0.dist-info}/entry_points.txt +0 -0
- {piccolo-1.9.0.dist-info → piccolo-1.10.0.dist-info}/top_level.txt +0 -0
@@ -1,10 +1,10 @@
|
|
1
|
-
piccolo/__init__.py,sha256=
|
1
|
+
piccolo/__init__.py,sha256=PUFn6Nk_mmFhCKTk02g04j8puY3N7KoIIwdxhzTnVRU,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
5
|
piccolo/querystring.py,sha256=_3enTH0oBx77LfpS9UG_5OGp5fMxmu50Dod5s1Gn9mY,9655
|
6
|
-
piccolo/schema.py,sha256=
|
7
|
-
piccolo/table.py,sha256=
|
6
|
+
piccolo/schema.py,sha256=qNNy4tG_HqnXR9t3hHMgYXtGxHabwQAhUpc6RKLJ_gE,7960
|
7
|
+
piccolo/table.py,sha256=IfXT9rtm1sBN-u_A8-_0gj6fJf3_RGSPtWMJa-FX9jw,49569
|
8
8
|
piccolo/table_reflection.py,sha256=jrN1nHerDJ4tU09GtNN3hz7ap-7rXnSUjljFO6LB2H0,7094
|
9
9
|
piccolo/apps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
piccolo/apps/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -49,7 +49,7 @@ piccolo/apps/fixtures/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
|
|
49
49
|
piccolo/apps/fixtures/piccolo_app.py,sha256=4O1Cznl1zms2gIw2iVjCjidkgCfFcB83nZIAJwcNTtg,268
|
50
50
|
piccolo/apps/fixtures/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
51
51
|
piccolo/apps/fixtures/commands/dump.py,sha256=UFkpV1e3UtayMf57WvFQbVsYpqFwo_gKoQC7oR3jdzc,3669
|
52
|
-
piccolo/apps/fixtures/commands/load.py,sha256=
|
52
|
+
piccolo/apps/fixtures/commands/load.py,sha256=Qnk8gT9iAcSGac6uALWHY26ikzg2npjGqYHMZGm6hVg,4216
|
53
53
|
piccolo/apps/fixtures/commands/shared.py,sha256=BMG8ku5FyK5vLewaDYwEfe_5HCnEVz1oKxHfL-GpO08,1462
|
54
54
|
piccolo/apps/meta/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
55
55
|
piccolo/apps/meta/piccolo_app.py,sha256=EdAB74BvwpwO9L8DOIMXPly9f4hiW3oaWdzoLNNV2a4,224
|
@@ -58,21 +58,21 @@ piccolo/apps/meta/commands/version.py,sha256=iDStZ7FPd5Da0vIAZrvFTCDev2yCtGBzWhl
|
|
58
58
|
piccolo/apps/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
59
59
|
piccolo/apps/migrations/piccolo_app.py,sha256=1EcS2ComBPCaMCC2C3WaPR_GqLwt3XiIJNfm5D2hMgo,593
|
60
60
|
piccolo/apps/migrations/tables.py,sha256=jqBnK-Rk545v1Eu6GaLHTVz7-uwBTUnz2m58OA-mxTc,799
|
61
|
-
piccolo/apps/migrations/auto/__init__.py,sha256=
|
61
|
+
piccolo/apps/migrations/auto/__init__.py,sha256=eYb1rZQaalumv_bhbcEe6x3dUglmpFtw7Egg6k7597U,316
|
62
62
|
piccolo/apps/migrations/auto/diffable_table.py,sha256=FJ_D7FvL_vaThgIY-zFyW_kFmReOI12saM3DFcaAvfw,7058
|
63
|
-
piccolo/apps/migrations/auto/migration_manager.py,sha256=
|
63
|
+
piccolo/apps/migrations/auto/migration_manager.py,sha256=3RuQPjnBfAfETkBdDPAVAXK3Bx-GW-37WL7uYNJ_sxI,35127
|
64
64
|
piccolo/apps/migrations/auto/operations.py,sha256=169IrCLR3FtTRxHsEHNg6dTG45lcEM7Aoyy3SwgX_hU,1329
|
65
65
|
piccolo/apps/migrations/auto/schema_differ.py,sha256=VA1rK-_wNSdyZZgfA3ZOlpVGJCcvLyouKtT9k2YKhiA,26266
|
66
66
|
piccolo/apps/migrations/auto/schema_snapshot.py,sha256=ZqUg4NpChOeoACKF2gkhqsz1BW3wOWFnzJCccq-CNNQ,4719
|
67
67
|
piccolo/apps/migrations/auto/serialisation.py,sha256=nlomUL-TwD_7Gjb8ttRZfIwn9VbNoEmRmD3LElP5e0k,23927
|
68
68
|
piccolo/apps/migrations/auto/serialisation_legacy.py,sha256=Edqx3YL0RGTsTHLNkHRNnXdfX6ut1h65U7UX2cI_BkE,1752
|
69
69
|
piccolo/apps/migrations/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
70
|
-
piccolo/apps/migrations/commands/backwards.py,sha256=
|
71
|
-
piccolo/apps/migrations/commands/base.py,sha256=
|
72
|
-
piccolo/apps/migrations/commands/check.py,sha256=
|
73
|
-
piccolo/apps/migrations/commands/clean.py,sha256=
|
74
|
-
piccolo/apps/migrations/commands/forwards.py,sha256=
|
75
|
-
piccolo/apps/migrations/commands/new.py,sha256=
|
70
|
+
piccolo/apps/migrations/commands/backwards.py,sha256=sBLotsdbwX11dji4H7YWgbaonluZSKBs6V3zFB3l4SY,6654
|
71
|
+
piccolo/apps/migrations/commands/base.py,sha256=iuF5-PppAVt6eOo0EOtISKuVGsfR3VVcyXCzRYNOcj4,4484
|
72
|
+
piccolo/apps/migrations/commands/check.py,sha256=JbzKAR_SFEs5dYvW0J_X4jgIpJDAHLIRz364JIZT6eQ,3991
|
73
|
+
piccolo/apps/migrations/commands/clean.py,sha256=JYs9VwvGN45tXM2iiaqGj3UQFZhJETrWahT0tcpGvBk,2864
|
74
|
+
piccolo/apps/migrations/commands/forwards.py,sha256=Xb_QqkGH3RNaJ256jjLBH8TSykNsnblSw4OPANzmXVA,5413
|
75
|
+
piccolo/apps/migrations/commands/new.py,sha256=k1cXGeydfrr3_kscwtahv7QdJW_DtTlUNHk7WW4Kfr8,7924
|
76
76
|
piccolo/apps/migrations/commands/templates/migration.py.jinja,sha256=wMC8RTIcQj3mjZh3FhuxuIfsqftZ5ivraO9fg-H6fbI,681
|
77
77
|
piccolo/apps/playground/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
78
78
|
piccolo/apps/playground/piccolo_app.py,sha256=zs6nGxt-lgUF8nEwI0uDTNZDKQqjZaNDH8le5RqrMNE,222
|
@@ -87,13 +87,13 @@ piccolo/apps/schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
|
|
87
87
|
piccolo/apps/schema/piccolo_app.py,sha256=De9eujzB6zWsP6J1gHYUk_f5_DpjvTZVXJsQ3eXBgnA,432
|
88
88
|
piccolo/apps/schema/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
89
89
|
piccolo/apps/schema/commands/exceptions.py,sha256=ZOGL3iV-xtWbWsImXObrXNaKtNPY_Qk1OmaOMOV6Ps0,236
|
90
|
-
piccolo/apps/schema/commands/generate.py,sha256=
|
90
|
+
piccolo/apps/schema/commands/generate.py,sha256=_niW_UxZ-x29-xjDIVdjHdDyKAaXn4HUDVtVjsXgBD0,30700
|
91
91
|
piccolo/apps/schema/commands/graph.py,sha256=FuQUPavUXpr-Y_11XRr11DbVLsgK8uG0IN8uBZIe5G4,3190
|
92
92
|
piccolo/apps/schema/commands/templates/graphviz.dot.jinja,sha256=-legygtsueOC70aboX35ZJpbCAXcv3E8RXXvFDQTeIY,1443
|
93
93
|
piccolo/apps/shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
94
94
|
piccolo/apps/shell/piccolo_app.py,sha256=LjyAvzNreSkeKM02VzR1E78S6QrcPjy1aGRFP-O4T9c,217
|
95
95
|
piccolo/apps/shell/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
96
|
-
piccolo/apps/shell/commands/run.py,sha256=
|
96
|
+
piccolo/apps/shell/commands/run.py,sha256=BiGMnM0wGKNvZOklgQeU_ZhBYWFxtsTQuvVHdod9Lzc,1628
|
97
97
|
piccolo/apps/sql_shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
98
98
|
piccolo/apps/sql_shell/piccolo_app.py,sha256=uFuMQIPLSMYi7y5x3wG1LPqGmEkwC-dYlmLTKrBaUQQ,221
|
99
99
|
piccolo/apps/sql_shell/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -117,37 +117,37 @@ piccolo/apps/user/piccolo_migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeu
|
|
117
117
|
piccolo/columns/__init__.py,sha256=OYhO_n9anMiU9nL-K6ATq9FhAtm8RyMpqYQ7fTVbhxI,1120
|
118
118
|
piccolo/columns/base.py,sha256=sgMiBvq-xLW6_W86g6XZTMc_3cskyeoMF6yIvIlnXsA,32487
|
119
119
|
piccolo/columns/choices.py,sha256=-HNQuk9vMmVZIPZ5PMeXGTfr23o4nzKPSAkvcG1k0y8,723
|
120
|
-
piccolo/columns/column_types.py,sha256=
|
120
|
+
piccolo/columns/column_types.py,sha256=YmltgnWhGLpmuMRimPPVQFmzF5hRDB7K1LaAjcI4Lmc,82364
|
121
121
|
piccolo/columns/combination.py,sha256=vMXC2dfY7pvnCFhsT71XFVyb4gdQzfRsCMaiduu04Ss,6900
|
122
122
|
piccolo/columns/indexes.py,sha256=NfNok3v_791jgDlN28KmhP9ZCjl6031BXmjxV3ovXJk,372
|
123
|
-
piccolo/columns/m2m.py,sha256=
|
123
|
+
piccolo/columns/m2m.py,sha256=17NY0wU7ta2rUTHYUkeA2HQhTDlJ_lyv9FxqvJiiUbY,14602
|
124
124
|
piccolo/columns/readable.py,sha256=hganxUPfIK5ZXn-qgteBxsOJfBJucgr9U0QLsLFYcuI,1562
|
125
125
|
piccolo/columns/reference.py,sha256=FqE9rpMBMwNNkKXR3Wi4ce-fyT2Vh4KM8YpdC21s6gg,3574
|
126
126
|
piccolo/columns/defaults/__init__.py,sha256=7hpB13baEJgc1zbZjRKDFr-5hltxM2VGj8KnKfOiS8c,145
|
127
|
-
piccolo/columns/defaults/base.py,sha256=
|
128
|
-
piccolo/columns/defaults/date.py,sha256=
|
129
|
-
piccolo/columns/defaults/interval.py,sha256=
|
130
|
-
piccolo/columns/defaults/time.py,sha256=
|
131
|
-
piccolo/columns/defaults/timestamp.py,sha256=
|
127
|
+
piccolo/columns/defaults/base.py,sha256=z_ZgtSFbLuwqdYdI7dr2n1SeyTJ7M4Ee4Ki7eRaBlVA,1869
|
128
|
+
piccolo/columns/defaults/date.py,sha256=Duuyi-QJ9Rr72aJkCNnjyO1CJBE-inZNGKnyV8tbLLE,2517
|
129
|
+
piccolo/columns/defaults/interval.py,sha256=ypaQpgDm1AL0WTMFEgKCt0I-e9ADUYdRRSBl65IJdiw,1987
|
130
|
+
piccolo/columns/defaults/time.py,sha256=2e0SDjl9_Mrw2YUeLFXDDYhmlC9Qjek3MkhvmWKQFH0,2417
|
131
|
+
piccolo/columns/defaults/timestamp.py,sha256=3Ng_LJ76nic-3j_AIzZfUvj3djIFRVkps98w1b_2lUM,3565
|
132
132
|
piccolo/columns/defaults/timestamptz.py,sha256=zN945oderS5HU22LMFLcT0iHlYt2wur99w-6lkbmWAI,2057
|
133
|
-
piccolo/columns/defaults/uuid.py,sha256=
|
133
|
+
piccolo/columns/defaults/uuid.py,sha256=zBBaXlUsDTKcxRFDWwqgpiDRrYd7ptxC_hf7UqYhRjY,470
|
134
134
|
piccolo/columns/operators/__init__.py,sha256=fIIm309C7ddqrP-M9oLlfhcZEM4Fx5B203QMzBm0OpM,310
|
135
135
|
piccolo/columns/operators/base.py,sha256=UfaqPd-ieqydrjhvcGYiwHMOKs199tTiT1gFE15DZzo,34
|
136
|
-
piccolo/columns/operators/comparison.py,sha256=
|
136
|
+
piccolo/columns/operators/comparison.py,sha256=G7bI_O-EXqun_zHwbNcZ9z9gsY8OK-0oBKjFqJbHcEc,1338
|
137
137
|
piccolo/columns/operators/math.py,sha256=knsUZzYOVdsFn3bTS0XC0ZzfNObeJcMvZ8Q_QwmGxjU,325
|
138
138
|
piccolo/columns/operators/string.py,sha256=M5ifxHP-ttJaE_wYCl23W5sJof4i5S5_QDIOv34VxDM,142
|
139
139
|
piccolo/conf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
140
|
-
piccolo/conf/apps.py,sha256=
|
140
|
+
piccolo/conf/apps.py,sha256=AlgOM2ePl9NQjME5AQxcZ5RbuQpjRywFCj5uHUsCIZU,19040
|
141
141
|
piccolo/engine/__init__.py,sha256=Z0QR5NAA9jTFenY7pEJv1C8jZXBaFZojBUR3z3nx1cw,283
|
142
|
-
piccolo/engine/base.py,sha256=
|
143
|
-
piccolo/engine/cockroach.py,sha256=
|
142
|
+
piccolo/engine/base.py,sha256=0a2yFX5dxq1A-AKXF-wpeQvYwnl2g437UjgJ37jGV0w,6190
|
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=
|
147
|
-
piccolo/engine/sqlite.py,sha256=
|
146
|
+
piccolo/engine/postgres.py,sha256=o1K6i2nhFc5u8mqHQN8KBXXt40djRngwclAnjhVvBgk,18725
|
147
|
+
piccolo/engine/sqlite.py,sha256=KwJc3UttBP_8qSREbLJshqEfROF17ENf0Ju9BwI5_so,25236
|
148
148
|
piccolo/query/__init__.py,sha256=bcsMV4813rMRAIqGv4DxI4eyO4FmpXkDv9dfTk5pt3A,699
|
149
149
|
piccolo/query/base.py,sha256=G8Mwz0GcHY4Xs5Co9ubCNMI-3orfOsDdRDOnFRws7TU,15212
|
150
|
-
piccolo/query/mixins.py,sha256=
|
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=e-BEHlGR3JhE2efWG_rmXdURKL4Fa8tjdGmPsvH4kWo,403
|
153
153
|
piccolo/query/functions/aggregate.py,sha256=OdjDjr_zyD4S9UbrZ2C3V5mz4OT2sIfAFAdTGr4WL54,4248
|
@@ -159,16 +159,16 @@ piccolo/query/methods/__init__.py,sha256=tm4gLeV_obDqpgnouVjFbGubbaoJcqm_cbNd4LP
|
|
159
159
|
piccolo/query/methods/alter.py,sha256=AI9YkJeip2EitrWJN_TDExXhA8HGAG3XuDz1NR-KirQ,16728
|
160
160
|
piccolo/query/methods/count.py,sha256=Vxn_7Ry-rleC6OGRxh-cLbuEMsy1DNjAZJThGED-_do,1748
|
161
161
|
piccolo/query/methods/create.py,sha256=hJ-6VVsWczzKDH6fQRN1WmYhcitixuXJ-eNOuCo_JgM,2742
|
162
|
-
piccolo/query/methods/create_index.py,sha256=
|
162
|
+
piccolo/query/methods/create_index.py,sha256=gip_cRXZkLfpJqCL7KHk2l_7HLptoa-Ae8qu6I5d5c8,2224
|
163
163
|
piccolo/query/methods/delete.py,sha256=3QNh8wsn2hUP1Ce9nz5ps1huU6ySHjyqkjdP-VYN-U8,2234
|
164
|
-
piccolo/query/methods/drop_index.py,sha256=
|
164
|
+
piccolo/query/methods/drop_index.py,sha256=5x3vHpoOmQ1SMhj6L7snKXX6M9l9j1E1PFSO6LMMkpY,1051
|
165
165
|
piccolo/query/methods/exists.py,sha256=lTMjtrFPFygZmaPV3sfQKXc3K0sVqJ2S6PDc3fRK6YQ,1203
|
166
166
|
piccolo/query/methods/indexes.py,sha256=J-QUqaBJwpgahskUH0Cu0Mq7zEKcfVAtDsUVIVX-C4c,943
|
167
167
|
piccolo/query/methods/insert.py,sha256=ssLJ_wn08KnOwwr7t-VILyn1P4hrvM63CfPIcAJWT5k,4701
|
168
|
-
piccolo/query/methods/objects.py,sha256=
|
168
|
+
piccolo/query/methods/objects.py,sha256=iahDUziUtlx7pJ2uBAhdm3hCTmg2AS9C8cal1my5KR0,11705
|
169
169
|
piccolo/query/methods/raw.py,sha256=VhYpCB52mZk4zqFTsqK5CHKTDGskUjISXTBV7UjohmA,600
|
170
170
|
piccolo/query/methods/refresh.py,sha256=P1Eo_HYU_L7kcGM_cvDDgyLi1boCXY7Pc4tv_eDAzvc,2769
|
171
|
-
piccolo/query/methods/select.py,sha256=
|
171
|
+
piccolo/query/methods/select.py,sha256=DjiTTyqoh95nK0m6Ru3UKjzybe1S5JlfeJ9IB2xR4VI,21270
|
172
172
|
piccolo/query/methods/table_exists.py,sha256=0yb3n6Jd2ovSBWlZ-gl00K4E7Jnbj7J8qAAX5d7hvNk,1259
|
173
173
|
piccolo/query/methods/update.py,sha256=LfWqIXEl1aecc0rkVssTFmwyD6wXGhlKcTrUVhtlEsw,3705
|
174
174
|
piccolo/testing/__init__.py,sha256=pRFSqRInfx95AakOq54atmvqoB-ue073q2aR8u8zR40,83
|
@@ -176,7 +176,7 @@ piccolo/testing/model_builder.py,sha256=lVEiEe71xrH8SSjzFc2l0s-VaCXHeg9Bo5oAYOEb
|
|
176
176
|
piccolo/testing/random_builder.py,sha256=0LkGpanQ7P1R82gLIMQyK9cm1LdZkPvxbShTEf3jeH4,2128
|
177
177
|
piccolo/utils/__init__.py,sha256=SDFFraauI9Op8dCRkreQv1dwUcab8Mi1eC-n0EwlTy8,36
|
178
178
|
piccolo/utils/dictionary.py,sha256=8vRPxgaXadDVhqihP1UxL7nUBgM6Gpe_Eu3xJq7zzGM,1886
|
179
|
-
piccolo/utils/encoding.py,sha256=
|
179
|
+
piccolo/utils/encoding.py,sha256=W34oj1F2f8zeirMceHZnAnJL2T8rPoiqXt-DJ-hzRGk,835
|
180
180
|
piccolo/utils/lazy_loader.py,sha256=T8GChEqtKWcBegn-6g_BQ7hOg2Xu1bedFh7Z8E7xcOY,1912
|
181
181
|
piccolo/utils/list.py,sha256=4hPGiksJWxL226W7gyYBcqVGgMTgVa2jP8zvalc3zw8,1541
|
182
182
|
piccolo/utils/naming.py,sha256=d7_mMscguK799RMhxFDifRgn8Ply5wiy2k1KkP22WUs,276
|
@@ -215,7 +215,7 @@ tests/apps/migrations/auto/test_schema_differ.py,sha256=UdsaZisA02j15wr1bXkXD6Cq
|
|
215
215
|
tests/apps/migrations/auto/test_schema_snapshot.py,sha256=ZyvGZqn3N3cwd-3S-FME5AJ8buDSHesw7yPIvY6mE5k,6196
|
216
216
|
tests/apps/migrations/auto/test_serialisation.py,sha256=EFkhES1w9h51UCamWrhxs3mf4I718ggeP7Yl5J_UID4,13548
|
217
217
|
tests/apps/migrations/auto/integration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
218
|
-
tests/apps/migrations/auto/integration/test_migrations.py,sha256=
|
218
|
+
tests/apps/migrations/auto/integration/test_migrations.py,sha256=t6QK3sSYovc4K68tySUo51H3a6LpubM442agiBYQxZ4,46753
|
219
219
|
tests/apps/migrations/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
220
220
|
tests/apps/migrations/commands/test_base.py,sha256=NgHgVjNd3Hil9eODvW7Ic2D9muTa_grNaH3YpRFfR8I,1829
|
221
221
|
tests/apps/migrations/commands/test_check.py,sha256=hOX_sVk1nfCRfbQ8tJoFEUBFhih9O4QuQLHTp5TQaiY,630
|
@@ -243,7 +243,7 @@ tests/apps/user/commands/test_change_permissions.py,sha256=uVKEiT1EKot3VA2TDETdQ
|
|
243
243
|
tests/apps/user/commands/test_create.py,sha256=iJ3Tti62rHwvdcTwNXrc5JPam6vR1qxKRdMN456vm3o,2250
|
244
244
|
tests/apps/user/commands/test_list.py,sha256=ipPfGdW6fH7q-Jc7JcYUvlioGmH9GQU0WImZGC2m-XQ,2840
|
245
245
|
tests/columns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
246
|
-
tests/columns/test_array.py,sha256=
|
246
|
+
tests/columns/test_array.py,sha256=sHYL2hEMwinoGz2u72Db9P3GxNuuH3oPUwzzKWmzX9s,11691
|
247
247
|
tests/columns/test_base.py,sha256=CTqCNcrqAJTjLXe3MCZgTczrmB3jcVRcOpU4FilpLoQ,3918
|
248
248
|
tests/columns/test_bigint.py,sha256=a0B4y1H02ww5qaW574X2lyenbY6o29ztOhiaqybPC0c,1149
|
249
249
|
tests/columns/test_boolean.py,sha256=kDESp6FnRtSZhuqIu0dBRwKMSpS5TFbbs3sz2MyZSs8,1720
|
@@ -276,13 +276,13 @@ tests/columns/m2m/test_m2m.py,sha256=LtNsHQ8xAzBFLiZVZhWEB56zu25FnaWtzJ62FZH3heI
|
|
276
276
|
tests/columns/m2m/test_m2m_schema.py,sha256=oxu7eAjFFpDjnq9Eq-5OTNmlnsEIMFWx18OItfpVs-s,339
|
277
277
|
tests/conf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
278
278
|
tests/conf/example.py,sha256=K8sTttLpEac8rQlOLDY500IGkHj3P3NoyFbCMnT1EqY,347
|
279
|
-
tests/conf/test_apps.py,sha256=
|
279
|
+
tests/conf/test_apps.py,sha256=Ovdp4v55iC-epS25sKntyYAw2ki9svcyCNOj5rOzE-E,8632
|
280
280
|
tests/engine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
281
281
|
tests/engine/test_extra_nodes.py,sha256=xW5gflHzM6ou26DqRSAZoaAbYVzF1IuMkW3vzNmB954,1298
|
282
282
|
tests/engine/test_logging.py,sha256=VLf9A3QuoV7OhV8lttLDB4gzZemnG63kSr-Uyan005U,1287
|
283
|
-
tests/engine/test_nested_transaction.py,sha256=
|
283
|
+
tests/engine/test_nested_transaction.py,sha256=3J91MvQ_z1d7v-z8_7pAh_zwHGoi_GUtmIDWlGcAZwk,2723
|
284
284
|
tests/engine/test_pool.py,sha256=ylucZNa3eL8cfrLjxPtduLpOdN_Z0e9Z6Rmrz-XpWp8,3890
|
285
|
-
tests/engine/test_transaction.py,sha256=
|
285
|
+
tests/engine/test_transaction.py,sha256=VTfQiQKpl_HtSQig6pl5tmBAP0d81z2djU6sYaxr_zE,9893
|
286
286
|
tests/engine/test_version_parsing.py,sha256=M1LODAVKHfj1apTMOwoC31LcI4vhiJRs1OO6P0WIsmE,793
|
287
287
|
tests/example_apps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
288
288
|
tests/example_apps/mega/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -324,7 +324,7 @@ tests/table/test_delete.py,sha256=dUfGOz0p0OdwxtWhEH88OXL6zB5sd4ZyKvVmMs08T98,12
|
|
324
324
|
tests/table/test_drop_db_tables.py,sha256=0a_aBZ8BMSLnu_DFXE_29X01B0jLdaa_WQ5_qTaZ5XY,1060
|
325
325
|
tests/table/test_exists.py,sha256=AHvhodkRof7PVd4IDdGQ2nyOj_1Cag1Rpg1H84s4jU0,283
|
326
326
|
tests/table/test_from_dict.py,sha256=I4PMxuzgkgi3-adaw9Gr3u5tQHexc31Vrq7RSPcPcJs,840
|
327
|
-
tests/table/test_indexes.py,sha256=
|
327
|
+
tests/table/test_indexes.py,sha256=VfM2FqFO8OOaL88QYQRqPX_PPniSBoPFeLPjXZ8jHBk,2073
|
328
328
|
tests/table/test_inheritance.py,sha256=AAkhEhhixVGweGe7ckzj-yypW-cj6D88Cca4-pjkwKw,3110
|
329
329
|
tests/table/test_insert.py,sha256=-xaoL6wTNB6UImiCk9NQKQ-B21l96H-9tN2_iEgXu5A,13695
|
330
330
|
tests/table/test_join.py,sha256=Ukgvjc8NweBGHM7fVFytGQYG9P9thRaMeEvWXYs2Qes,15910
|
@@ -358,14 +358,14 @@ tests/utils/test_lazy_loader.py,sha256=wDWhlV2IR6RuTaYCI5eWesz465WqIscYEJjwWnPrh
|
|
358
358
|
tests/utils/test_list.py,sha256=25UoStmrYS_JDOKsXYqTDc3FUkOe3dUcy51r0I6grK0,769
|
359
359
|
tests/utils/test_naming.py,sha256=ncJdzkMHSVFo2YQLkRhY93WJ8_W_j2pW9tHHL_ZgQcs,661
|
360
360
|
tests/utils/test_printing.py,sha256=W8pQyWX2pEkLdMYWxtibFXJnI4MVsb6XMOTo3DZUuZc,668
|
361
|
-
tests/utils/test_pydantic.py,sha256=
|
361
|
+
tests/utils/test_pydantic.py,sha256=TjKai2_TQklwAPGONGFSY4zYkals_bGiKGBCzTH9ntU,27783
|
362
362
|
tests/utils/test_sql_values.py,sha256=vzxRmy16FfLZPH-sAQexBvsF9MXB8n4smr14qoEOS5E,2535
|
363
363
|
tests/utils/test_sync.py,sha256=9ytVo56y2vPQePvTeIi9lHIouEhWJbodl1TmzkGFrSo,799
|
364
364
|
tests/utils/test_table_reflection.py,sha256=SIzuat-IpcVj1GCFyOWKShI8YkhdOPPFH7qVrvfyPNE,3794
|
365
365
|
tests/utils/test_warnings.py,sha256=NvSC_cvJ6uZcwAGf1m-hLzETXCqprXELL8zg3TNLVMw,269
|
366
|
-
piccolo-1.
|
367
|
-
piccolo-1.
|
368
|
-
piccolo-1.
|
369
|
-
piccolo-1.
|
370
|
-
piccolo-1.
|
371
|
-
piccolo-1.
|
366
|
+
piccolo-1.10.0.dist-info/LICENSE,sha256=zFIpi-16uIJ420UMIG75NU0JbDBykvrdnXcj5U_EYBI,1059
|
367
|
+
piccolo-1.10.0.dist-info/METADATA,sha256=iOzLZbrVstdxKNx_ifn_M7voMrX0KkQsBcPB39vw0VE,5178
|
368
|
+
piccolo-1.10.0.dist-info/WHEEL,sha256=00yskusixUoUt5ob_CiUp6LsnN5lqzTJpoqOFg_FVIc,92
|
369
|
+
piccolo-1.10.0.dist-info/entry_points.txt,sha256=SJPHET4Fi1bN5F3WqcKkv9SClK3_F1I7m4eQjk6AFh0,46
|
370
|
+
piccolo-1.10.0.dist-info/top_level.txt,sha256=-SR74VGbk43VoPy1HH-mHm97yoGukLK87HE5kdBW6qM,24
|
371
|
+
piccolo-1.10.0.dist-info/RECORD,,
|
@@ -145,7 +145,7 @@ class MigrationTestCase(DBTestCase):
|
|
145
145
|
"""
|
146
146
|
app_config = self._get_app_config()
|
147
147
|
|
148
|
-
migrations_folder_path = app_config.
|
148
|
+
migrations_folder_path = app_config.resolved_migrations_folder_path
|
149
149
|
|
150
150
|
if os.path.exists(migrations_folder_path):
|
151
151
|
shutil.rmtree(migrations_folder_path)
|
tests/columns/test_array.py
CHANGED
@@ -157,6 +157,34 @@ class TestArray(TestCase):
|
|
157
157
|
None,
|
158
158
|
)
|
159
159
|
|
160
|
+
@engines_skip("sqlite")
|
161
|
+
@pytest.mark.cockroach_array_slow
|
162
|
+
def test_not_any(self):
|
163
|
+
"""
|
164
|
+
Make sure rows can be retrieved where the array doesn't contain a
|
165
|
+
certain value.
|
166
|
+
|
167
|
+
In CockroachDB <= v22.2.0 we had this error:
|
168
|
+
|
169
|
+
* https://github.com/cockroachdb/cockroach/issues/71908 "could not decorrelate subquery" error under asyncpg
|
170
|
+
|
171
|
+
In newer CockroachDB versions, it runs but is very slow:
|
172
|
+
|
173
|
+
* https://github.com/piccolo-orm/piccolo/issues/1005
|
174
|
+
|
175
|
+
""" # noqa: E501
|
176
|
+
|
177
|
+
MyTable(value=[1, 2, 3]).save().run_sync()
|
178
|
+
MyTable(value=[4, 5, 6]).save().run_sync()
|
179
|
+
|
180
|
+
# We have to explicitly specify the type, so CockroachDB works.
|
181
|
+
self.assertEqual(
|
182
|
+
MyTable.select(MyTable.value)
|
183
|
+
.where(MyTable.value.not_any(QueryString("{}::INTEGER", 4)))
|
184
|
+
.run_sync(),
|
185
|
+
[{"value": [1, 2, 3]}],
|
186
|
+
)
|
187
|
+
|
160
188
|
@engines_skip("sqlite")
|
161
189
|
@pytest.mark.cockroach_array_slow
|
162
190
|
def test_cat(self):
|
tests/conf/test_apps.py
CHANGED
@@ -85,7 +85,7 @@ class TestAppConfig(TestCase):
|
|
85
85
|
config = AppConfig(
|
86
86
|
app_name="music", migrations_folder_path=pathlib.Path(__file__)
|
87
87
|
)
|
88
|
-
self.assertEqual(config.
|
88
|
+
self.assertEqual(config.resolved_migrations_folder_path, __file__)
|
89
89
|
|
90
90
|
def test_get_table_with_name(self):
|
91
91
|
"""
|
@@ -45,10 +45,12 @@ class TestDifferentDB(TestCase):
|
|
45
45
|
|
46
46
|
self.assertTrue(await Musician.table_exists().run())
|
47
47
|
musician = await Musician.select("name").first().run()
|
48
|
+
assert musician is not None
|
48
49
|
self.assertEqual(musician["name"], "Bob")
|
49
50
|
|
50
51
|
self.assertTrue(await Roadie.table_exists().run())
|
51
52
|
roadie = await Roadie.select("name").first().run()
|
53
|
+
assert roadie is not None
|
52
54
|
self.assertEqual(roadie["name"], "Dave")
|
53
55
|
|
54
56
|
def test_nested(self):
|
tests/engine/test_transaction.py
CHANGED
@@ -4,7 +4,6 @@ from unittest import TestCase
|
|
4
4
|
|
5
5
|
import pytest
|
6
6
|
|
7
|
-
from piccolo.engine.postgres import Atomic
|
8
7
|
from piccolo.engine.sqlite import SQLiteEngine, TransactionType
|
9
8
|
from piccolo.table import drop_db_tables_sync
|
10
9
|
from piccolo.utils.sync import run_sync
|
@@ -58,7 +57,7 @@ class TestAtomic(TestCase):
|
|
58
57
|
engine = Band._meta.db
|
59
58
|
await engine.start_connection_pool()
|
60
59
|
|
61
|
-
atomic
|
60
|
+
atomic = engine.atomic()
|
62
61
|
atomic.add(
|
63
62
|
Manager.create_table(),
|
64
63
|
Band.create_table(),
|
tests/table/test_indexes.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
import typing as t
|
1
2
|
from unittest import TestCase
|
2
3
|
|
4
|
+
from piccolo.columns.base import Column
|
3
5
|
from piccolo.columns.column_types import Integer
|
4
6
|
from piccolo.table import Table
|
5
7
|
from tests.example_apps.music.tables import Manager
|
@@ -45,12 +47,12 @@ class TestProblematicColumnName(TestCase):
|
|
45
47
|
def tearDown(self):
|
46
48
|
Concert.alter().drop_table().run_sync()
|
47
49
|
|
48
|
-
def test_problematic_name(self):
|
50
|
+
def test_problematic_name(self) -> None:
|
49
51
|
"""
|
50
52
|
Make sure we can add an index to a column with a problematic name
|
51
53
|
(which clashes with a SQL keyword).
|
52
54
|
"""
|
53
|
-
columns = [Concert.order]
|
55
|
+
columns: t.List[Column] = [Concert.order]
|
54
56
|
Concert.create_index(columns=columns).run_sync()
|
55
57
|
index_name = Concert._get_index_name([i._meta.name for i in columns])
|
56
58
|
|
tests/utils/test_pydantic.py
CHANGED
@@ -274,6 +274,7 @@ class TestUUIDColumn(TestCase):
|
|
274
274
|
# We'll also fetch it from the DB in case the database adapter's UUID
|
275
275
|
# is used.
|
276
276
|
ticket_from_db = Ticket.objects().first().run_sync()
|
277
|
+
assert ticket_from_db is not None
|
277
278
|
|
278
279
|
for ticket_ in (ticket, ticket_from_db):
|
279
280
|
json = pydantic_model(**ticket_.to_dict()).model_dump_json()
|
@@ -368,8 +369,8 @@ class TestJSONColumn(TestCase):
|
|
368
369
|
json_string = '{"code": 12345}'
|
369
370
|
|
370
371
|
model_instance = pydantic_model(meta=json_string, meta_b=json_string)
|
371
|
-
self.assertEqual(model_instance.meta, json_string)
|
372
|
-
self.assertEqual(model_instance.meta_b, json_string)
|
372
|
+
self.assertEqual(model_instance.meta, json_string) # type: ignore
|
373
|
+
self.assertEqual(model_instance.meta_b, json_string) # type: ignore
|
373
374
|
|
374
375
|
def test_deserialize_json(self):
|
375
376
|
class Movie(Table):
|
@@ -384,8 +385,8 @@ class TestJSONColumn(TestCase):
|
|
384
385
|
output = {"code": 12345}
|
385
386
|
|
386
387
|
model_instance = pydantic_model(meta=json_string, meta_b=json_string)
|
387
|
-
self.assertEqual(model_instance.meta, output)
|
388
|
-
self.assertEqual(model_instance.meta_b, output)
|
388
|
+
self.assertEqual(model_instance.meta, output) # type: ignore
|
389
|
+
self.assertEqual(model_instance.meta_b, output) # type: ignore
|
389
390
|
|
390
391
|
def test_validation(self):
|
391
392
|
class Movie(Table):
|
@@ -428,8 +429,8 @@ class TestJSONColumn(TestCase):
|
|
428
429
|
pydantic_model = create_pydantic_model(table=Movie)
|
429
430
|
movie = pydantic_model(meta=None, meta_b=None)
|
430
431
|
|
431
|
-
self.assertIsNone(movie.meta)
|
432
|
-
self.assertIsNone(movie.meta_b)
|
432
|
+
self.assertIsNone(movie.meta) # type: ignore
|
433
|
+
self.assertIsNone(movie.meta_b) # type: ignore
|
433
434
|
|
434
435
|
|
435
436
|
class TestExcludeColumns(TestCase):
|
@@ -490,7 +491,7 @@ class TestExcludeColumns(TestCase):
|
|
490
491
|
with self.assertRaises(ValueError):
|
491
492
|
create_pydantic_model(
|
492
493
|
Computer,
|
493
|
-
exclude_columns=("CPU",),
|
494
|
+
exclude_columns=("CPU",), # type: ignore
|
494
495
|
)
|
495
496
|
|
496
497
|
def test_invalid_column_different_table(self):
|
@@ -629,7 +630,10 @@ class TestNestedModel(TestCase):
|
|
629
630
|
|
630
631
|
#######################################################################
|
631
632
|
|
632
|
-
ManagerModel =
|
633
|
+
ManagerModel = t.cast(
|
634
|
+
t.Type[pydantic.BaseModel],
|
635
|
+
BandModel.model_fields["manager"].annotation,
|
636
|
+
)
|
633
637
|
self.assertTrue(issubclass(ManagerModel, pydantic.BaseModel))
|
634
638
|
self.assertEqual(
|
635
639
|
[i for i in ManagerModel.model_fields.keys()], ["name", "country"]
|
@@ -637,7 +641,10 @@ class TestNestedModel(TestCase):
|
|
637
641
|
|
638
642
|
#######################################################################
|
639
643
|
|
640
|
-
CountryModel =
|
644
|
+
CountryModel = t.cast(
|
645
|
+
t.Type[pydantic.BaseModel],
|
646
|
+
ManagerModel.model_fields["country"].annotation,
|
647
|
+
)
|
641
648
|
self.assertTrue(issubclass(CountryModel, pydantic.BaseModel))
|
642
649
|
self.assertEqual(
|
643
650
|
[i for i in CountryModel.model_fields.keys()], ["name"]
|
@@ -674,7 +681,10 @@ class TestNestedModel(TestCase):
|
|
674
681
|
|
675
682
|
BandModel = create_pydantic_model(table=Band, nested=(Band.manager,))
|
676
683
|
|
677
|
-
ManagerModel =
|
684
|
+
ManagerModel = t.cast(
|
685
|
+
t.Type[pydantic.BaseModel],
|
686
|
+
BandModel.model_fields["manager"].annotation,
|
687
|
+
)
|
678
688
|
self.assertTrue(issubclass(ManagerModel, pydantic.BaseModel))
|
679
689
|
self.assertEqual(
|
680
690
|
[i for i in ManagerModel.model_fields.keys()], ["name", "country"]
|
@@ -690,22 +700,29 @@ class TestNestedModel(TestCase):
|
|
690
700
|
# Test two levels deep
|
691
701
|
|
692
702
|
BandModel = create_pydantic_model(
|
693
|
-
table=Band, nested=(Band.manager.country,)
|
703
|
+
table=Band, nested=(Band.manager._.country,)
|
694
704
|
)
|
695
705
|
|
696
|
-
ManagerModel =
|
706
|
+
ManagerModel = t.cast(
|
707
|
+
t.Type[pydantic.BaseModel],
|
708
|
+
BandModel.model_fields["manager"].annotation,
|
709
|
+
)
|
697
710
|
self.assertTrue(issubclass(ManagerModel, pydantic.BaseModel))
|
698
711
|
self.assertEqual(
|
699
712
|
[i for i in ManagerModel.model_fields.keys()], ["name", "country"]
|
700
713
|
)
|
701
714
|
self.assertEqual(ManagerModel.__qualname__, "Band.manager")
|
702
715
|
|
703
|
-
AssistantManagerType =
|
704
|
-
|
705
|
-
|
716
|
+
AssistantManagerType = t.cast(
|
717
|
+
t.Type[pydantic.BaseModel],
|
718
|
+
BandModel.model_fields["assistant_manager"].annotation,
|
719
|
+
)
|
706
720
|
self.assertIs(AssistantManagerType, t.Optional[int])
|
707
721
|
|
708
|
-
CountryModel =
|
722
|
+
CountryModel = t.cast(
|
723
|
+
t.Type[pydantic.BaseModel],
|
724
|
+
ManagerModel.model_fields["country"].annotation,
|
725
|
+
)
|
709
726
|
self.assertTrue(issubclass(CountryModel, pydantic.BaseModel))
|
710
727
|
self.assertEqual(
|
711
728
|
[i for i in CountryModel.model_fields.keys()], ["name"]
|
@@ -716,13 +733,16 @@ class TestNestedModel(TestCase):
|
|
716
733
|
# Test three levels deep
|
717
734
|
|
718
735
|
ConcertModel = create_pydantic_model(
|
719
|
-
Concert, nested=(Concert.band_1.manager,)
|
736
|
+
Concert, nested=(Concert.band_1._.manager,)
|
720
737
|
)
|
721
738
|
|
722
739
|
VenueModel = ConcertModel.model_fields["venue"].annotation
|
723
740
|
self.assertIs(VenueModel, t.Optional[int])
|
724
741
|
|
725
|
-
BandModel =
|
742
|
+
BandModel = t.cast(
|
743
|
+
t.Type[pydantic.BaseModel],
|
744
|
+
ConcertModel.model_fields["band_1"].annotation,
|
745
|
+
)
|
726
746
|
self.assertTrue(issubclass(BandModel, pydantic.BaseModel))
|
727
747
|
self.assertEqual(
|
728
748
|
[i for i in BandModel.model_fields.keys()],
|
@@ -730,7 +750,10 @@ class TestNestedModel(TestCase):
|
|
730
750
|
)
|
731
751
|
self.assertEqual(BandModel.__qualname__, "Concert.band_1")
|
732
752
|
|
733
|
-
ManagerModel =
|
753
|
+
ManagerModel = t.cast(
|
754
|
+
t.Type[pydantic.BaseModel],
|
755
|
+
BandModel.model_fields["manager"].annotation,
|
756
|
+
)
|
734
757
|
self.assertTrue(issubclass(ManagerModel, pydantic.BaseModel))
|
735
758
|
self.assertEqual(
|
736
759
|
[i for i in ManagerModel.model_fields.keys()],
|
@@ -751,11 +774,14 @@ class TestNestedModel(TestCase):
|
|
751
774
|
|
752
775
|
MyConcertModel = create_pydantic_model(
|
753
776
|
Concert,
|
754
|
-
nested=(Concert.band_1.manager,),
|
777
|
+
nested=(Concert.band_1._.manager,),
|
755
778
|
model_name="MyConcertModel",
|
756
779
|
)
|
757
780
|
|
758
|
-
BandModel =
|
781
|
+
BandModel = t.cast(
|
782
|
+
t.Type[pydantic.BaseModel],
|
783
|
+
MyConcertModel.model_fields["band_1"].annotation,
|
784
|
+
)
|
759
785
|
self.assertEqual(BandModel.__qualname__, "MyConcertModel.band_1")
|
760
786
|
|
761
787
|
ManagerModel = BandModel.model_fields["manager"].annotation
|
@@ -763,7 +789,7 @@ class TestNestedModel(TestCase):
|
|
763
789
|
ManagerModel.__qualname__, "MyConcertModel.band_1.manager"
|
764
790
|
)
|
765
791
|
|
766
|
-
def test_cascaded_args(self):
|
792
|
+
def test_cascaded_args(self) -> None:
|
767
793
|
"""
|
768
794
|
Make sure that arguments passed to ``create_pydantic_model`` are
|
769
795
|
cascaded to nested models.
|
@@ -784,14 +810,20 @@ class TestNestedModel(TestCase):
|
|
784
810
|
table=Band, nested=True, include_default_columns=True
|
785
811
|
)
|
786
812
|
|
787
|
-
ManagerModel =
|
813
|
+
ManagerModel = t.cast(
|
814
|
+
t.Type[pydantic.BaseModel],
|
815
|
+
BandModel.model_fields["manager"].annotation,
|
816
|
+
)
|
788
817
|
self.assertTrue(issubclass(ManagerModel, pydantic.BaseModel))
|
789
818
|
self.assertEqual(
|
790
819
|
[i for i in ManagerModel.model_fields.keys()],
|
791
820
|
["id", "name", "country"],
|
792
821
|
)
|
793
822
|
|
794
|
-
CountryModel =
|
823
|
+
CountryModel = t.cast(
|
824
|
+
t.Type[pydantic.BaseModel],
|
825
|
+
ManagerModel.model_fields["country"].annotation,
|
826
|
+
)
|
795
827
|
self.assertTrue(issubclass(CountryModel, pydantic.BaseModel))
|
796
828
|
self.assertEqual(
|
797
829
|
[i for i in CountryModel.model_fields.keys()], ["id", "name"]
|
@@ -823,13 +855,22 @@ class TestRecursionDepth(TestCase):
|
|
823
855
|
table=Concert, nested=True, max_recursion_depth=2
|
824
856
|
)
|
825
857
|
|
826
|
-
VenueModel =
|
858
|
+
VenueModel = t.cast(
|
859
|
+
t.Type[pydantic.BaseModel],
|
860
|
+
ConcertModel.model_fields["venue"].annotation,
|
861
|
+
)
|
827
862
|
self.assertTrue(issubclass(VenueModel, pydantic.BaseModel))
|
828
863
|
|
829
|
-
BandModel =
|
864
|
+
BandModel = t.cast(
|
865
|
+
t.Type[pydantic.BaseModel],
|
866
|
+
ConcertModel.model_fields["band"].annotation,
|
867
|
+
)
|
830
868
|
self.assertTrue(issubclass(BandModel, pydantic.BaseModel))
|
831
869
|
|
832
|
-
ManagerModel =
|
870
|
+
ManagerModel = t.cast(
|
871
|
+
t.Type[pydantic.BaseModel],
|
872
|
+
BandModel.model_fields["manager"].annotation,
|
873
|
+
)
|
833
874
|
self.assertTrue(issubclass(ManagerModel, pydantic.BaseModel))
|
834
875
|
|
835
876
|
# We should have hit the recursion depth:
|
@@ -851,7 +892,7 @@ class TestDBColumnName(TestCase):
|
|
851
892
|
|
852
893
|
model = BandModel(regrettable_column_name="test")
|
853
894
|
|
854
|
-
self.assertEqual(model.name, "test")
|
895
|
+
self.assertEqual(model.name, "test") # type: ignore
|
855
896
|
|
856
897
|
|
857
898
|
class TestJSONSchemaExtra(TestCase):
|
@@ -885,7 +926,7 @@ class TestPydanticExtraFields(TestCase):
|
|
885
926
|
config: pydantic.config.ConfigDict = {"extra": "forbid"}
|
886
927
|
model = create_pydantic_model(Band, pydantic_config=config)
|
887
928
|
|
888
|
-
self.assertEqual(model.model_config
|
929
|
+
self.assertEqual(model.model_config.get("extra"), "forbid")
|
889
930
|
|
890
931
|
def test_pydantic_invalid_extra_fields(self) -> None:
|
891
932
|
"""
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|