piccolo 1.24.0__py3-none-any.whl → 1.24.2__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/combination.py +5 -5
- piccolo/columns/defaults/timestamp.py +5 -1
- piccolo/columns/defaults/timestamptz.py +3 -1
- piccolo/query/methods/delete.py +1 -1
- piccolo/query/methods/update.py +1 -1
- {piccolo-1.24.0.dist-info → piccolo-1.24.2.dist-info}/METADATA +3 -2
- {piccolo-1.24.0.dist-info → piccolo-1.24.2.dist-info}/RECORD +14 -14
- {piccolo-1.24.0.dist-info → piccolo-1.24.2.dist-info}/WHEEL +1 -1
- tests/columns/test_defaults.py +34 -0
- tests/table/test_delete.py +15 -0
- {piccolo-1.24.0.dist-info → piccolo-1.24.2.dist-info}/entry_points.txt +0 -0
- {piccolo-1.24.0.dist-info → piccolo-1.24.2.dist-info/licenses}/LICENSE +0 -0
- {piccolo-1.24.0.dist-info → piccolo-1.24.2.dist-info}/top_level.txt +0 -0
piccolo/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__VERSION__ = "1.24.
|
1
|
+
__VERSION__ = "1.24.2"
|
piccolo/columns/combination.py
CHANGED
@@ -45,11 +45,11 @@ class Combination(CombinableMixin):
|
|
45
45
|
)
|
46
46
|
|
47
47
|
@property
|
48
|
-
def
|
48
|
+
def querystring_for_update_and_delete(self) -> QueryString:
|
49
49
|
return QueryString(
|
50
50
|
"({} " + self.operator + " {})",
|
51
|
-
self.first.
|
52
|
-
self.second.
|
51
|
+
self.first.querystring_for_update_and_delete,
|
52
|
+
self.second.querystring_for_update_and_delete,
|
53
53
|
)
|
54
54
|
|
55
55
|
def __str__(self):
|
@@ -131,7 +131,7 @@ class WhereRaw(CombinableMixin):
|
|
131
131
|
self.querystring = QueryString(sql, *args)
|
132
132
|
|
133
133
|
@property
|
134
|
-
def
|
134
|
+
def querystring_for_update_and_delete(self) -> QueryString:
|
135
135
|
return self.querystring
|
136
136
|
|
137
137
|
def __str__(self):
|
@@ -218,7 +218,7 @@ class Where(CombinableMixin):
|
|
218
218
|
return QueryString(template, *args)
|
219
219
|
|
220
220
|
@property
|
221
|
-
def
|
221
|
+
def querystring_for_update_and_delete(self) -> QueryString:
|
222
222
|
args: t.List[t.Any] = []
|
223
223
|
if self.value != UNDEFINED:
|
224
224
|
args.append(self.value)
|
@@ -70,6 +70,7 @@ class TimestampCustom(Default):
|
|
70
70
|
month: int = 1,
|
71
71
|
day: int = 1,
|
72
72
|
hour: int = 0,
|
73
|
+
minute: int = 0,
|
73
74
|
second: int = 0,
|
74
75
|
microsecond: int = 0,
|
75
76
|
):
|
@@ -77,6 +78,7 @@ class TimestampCustom(Default):
|
|
77
78
|
self.month = month
|
78
79
|
self.day = day
|
79
80
|
self.hour = hour
|
81
|
+
self.minute = minute
|
80
82
|
self.second = second
|
81
83
|
self.microsecond = microsecond
|
82
84
|
|
@@ -87,6 +89,7 @@ class TimestampCustom(Default):
|
|
87
89
|
month=self.month,
|
88
90
|
day=self.day,
|
89
91
|
hour=self.hour,
|
92
|
+
minute=self.minute,
|
90
93
|
second=self.second,
|
91
94
|
microsecond=self.microsecond,
|
92
95
|
)
|
@@ -113,8 +116,9 @@ class TimestampCustom(Default):
|
|
113
116
|
return cls(
|
114
117
|
year=instance.year,
|
115
118
|
month=instance.month,
|
116
|
-
day=instance.
|
119
|
+
day=instance.day,
|
117
120
|
hour=instance.hour,
|
121
|
+
minute=instance.minute,
|
118
122
|
second=instance.second,
|
119
123
|
microsecond=instance.microsecond,
|
120
124
|
)
|
@@ -47,6 +47,7 @@ class TimestamptzCustom(TimestampCustom):
|
|
47
47
|
month=self.month,
|
48
48
|
day=self.day,
|
49
49
|
hour=self.hour,
|
50
|
+
minute=self.minute,
|
50
51
|
second=self.second,
|
51
52
|
microsecond=self.microsecond,
|
52
53
|
tzinfo=datetime.timezone.utc,
|
@@ -59,8 +60,9 @@ class TimestamptzCustom(TimestampCustom):
|
|
59
60
|
return cls(
|
60
61
|
year=instance.year,
|
61
62
|
month=instance.month,
|
62
|
-
day=instance.
|
63
|
+
day=instance.day,
|
63
64
|
hour=instance.hour,
|
65
|
+
minute=instance.minute,
|
64
66
|
second=instance.second,
|
65
67
|
microsecond=instance.microsecond,
|
66
68
|
)
|
piccolo/query/methods/delete.py
CHANGED
piccolo/query/methods/update.py
CHANGED
@@ -104,7 +104,7 @@ class Update(Query[TableInstance, t.List[t.Any]]):
|
|
104
104
|
querystring = QueryString(
|
105
105
|
"{} WHERE {}",
|
106
106
|
querystring,
|
107
|
-
self.where_delegate._where.
|
107
|
+
self.where_delegate._where.querystring_for_update_and_delete,
|
108
108
|
)
|
109
109
|
|
110
110
|
if self.returning_delegate._returning:
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: piccolo
|
3
|
-
Version: 1.24.
|
3
|
+
Version: 1.24.2
|
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
|
@@ -54,6 +54,7 @@ Dynamic: description
|
|
54
54
|
Dynamic: description-content-type
|
55
55
|
Dynamic: home-page
|
56
56
|
Dynamic: license
|
57
|
+
Dynamic: license-file
|
57
58
|
Dynamic: project-url
|
58
59
|
Dynamic: provides-extra
|
59
60
|
Dynamic: requires-dist
|
@@ -1,4 +1,4 @@
|
|
1
|
-
piccolo/__init__.py,sha256=
|
1
|
+
piccolo/__init__.py,sha256=53bY15Zwtb-mVcNomjadBbUceria081xCDSw7iTXiZM,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
|
@@ -124,7 +124,7 @@ piccolo/columns/__init__.py,sha256=OYhO_n9anMiU9nL-K6ATq9FhAtm8RyMpqYQ7fTVbhxI,1
|
|
124
124
|
piccolo/columns/base.py,sha256=_bg9yMWjMwE76Z7RDqi9iYSmtRuFx5bkx9uYJsFHKjQ,32487
|
125
125
|
piccolo/columns/choices.py,sha256=-HNQuk9vMmVZIPZ5PMeXGTfr23o4nzKPSAkvcG1k0y8,723
|
126
126
|
piccolo/columns/column_types.py,sha256=Wo6g14aL1vpOFugsY-6n-q6JUJaKih-cIn9NBp-f3fI,84759
|
127
|
-
piccolo/columns/combination.py,sha256=
|
127
|
+
piccolo/columns/combination.py,sha256=NUOxmYcx84JW-2FcoF1XJVp_4R01aTJyl3waPzfZ4Tc,6955
|
128
128
|
piccolo/columns/indexes.py,sha256=NfNok3v_791jgDlN28KmhP9ZCjl6031BXmjxV3ovXJk,372
|
129
129
|
piccolo/columns/m2m.py,sha256=QMeSOnm4DT2cG9U5jC6sOZ6z9DxCWwDyZMSqk0wR2q4,14682
|
130
130
|
piccolo/columns/readable.py,sha256=hganxUPfIK5ZXn-qgteBxsOJfBJucgr9U0QLsLFYcuI,1562
|
@@ -134,8 +134,8 @@ piccolo/columns/defaults/base.py,sha256=z_ZgtSFbLuwqdYdI7dr2n1SeyTJ7M4Ee4Ki7eRaB
|
|
134
134
|
piccolo/columns/defaults/date.py,sha256=Duuyi-QJ9Rr72aJkCNnjyO1CJBE-inZNGKnyV8tbLLE,2517
|
135
135
|
piccolo/columns/defaults/interval.py,sha256=ypaQpgDm1AL0WTMFEgKCt0I-e9ADUYdRRSBl65IJdiw,1987
|
136
136
|
piccolo/columns/defaults/time.py,sha256=2e0SDjl9_Mrw2YUeLFXDDYhmlC9Qjek3MkhvmWKQFH0,2417
|
137
|
-
piccolo/columns/defaults/timestamp.py,sha256=
|
138
|
-
piccolo/columns/defaults/timestamptz.py,sha256=
|
137
|
+
piccolo/columns/defaults/timestamp.py,sha256=O7SDldwDku8Bd3n0JPxUSzYo7FDYrgWgdxI-0o4sOvk,3685
|
138
|
+
piccolo/columns/defaults/timestamptz.py,sha256=9xCpIbxH4gy8UY8Ucc_OGwN9hOOzXz7PbXKaNQx6UNs,2162
|
139
139
|
piccolo/columns/defaults/uuid.py,sha256=zBBaXlUsDTKcxRFDWwqgpiDRrYd7ptxC_hf7UqYhRjY,470
|
140
140
|
piccolo/columns/operators/__init__.py,sha256=fIIm309C7ddqrP-M9oLlfhcZEM4Fx5B203QMzBm0OpM,310
|
141
141
|
piccolo/columns/operators/base.py,sha256=UfaqPd-ieqydrjhvcGYiwHMOKs199tTiT1gFE15DZzo,34
|
@@ -167,7 +167,7 @@ piccolo/query/methods/alter.py,sha256=AI9YkJeip2EitrWJN_TDExXhA8HGAG3XuDz1NR-Kir
|
|
167
167
|
piccolo/query/methods/count.py,sha256=Vxn_7Ry-rleC6OGRxh-cLbuEMsy1DNjAZJThGED-_do,1748
|
168
168
|
piccolo/query/methods/create.py,sha256=hJ-6VVsWczzKDH6fQRN1WmYhcitixuXJ-eNOuCo_JgM,2742
|
169
169
|
piccolo/query/methods/create_index.py,sha256=gip_cRXZkLfpJqCL7KHk2l_7HLptoa-Ae8qu6I5d5c8,2224
|
170
|
-
piccolo/query/methods/delete.py,sha256=
|
170
|
+
piccolo/query/methods/delete.py,sha256=X11IjaQ4kIPGDtYGVQBqbkm3MP6fDI2WuP4h1ri4zSQ,2256
|
171
171
|
piccolo/query/methods/drop_index.py,sha256=5x3vHpoOmQ1SMhj6L7snKXX6M9l9j1E1PFSO6LMMkpY,1051
|
172
172
|
piccolo/query/methods/exists.py,sha256=lTMjtrFPFygZmaPV3sfQKXc3K0sVqJ2S6PDc3fRK6YQ,1203
|
173
173
|
piccolo/query/methods/indexes.py,sha256=J-QUqaBJwpgahskUH0Cu0Mq7zEKcfVAtDsUVIVX-C4c,943
|
@@ -177,7 +177,7 @@ piccolo/query/methods/raw.py,sha256=wQWR8b-yA_Gr-5lqRMZe9BOAAMBAw8CqTx37qVYvM1A,
|
|
177
177
|
piccolo/query/methods/refresh.py,sha256=wg1zghKfwz-VmqK4uWa4GNMiDtK-skTqow591Hb3ONM,5854
|
178
178
|
piccolo/query/methods/select.py,sha256=41OW-DIE_wr5VdxSusMKNT2aUhzQsCwK2Qh1XqgXHg0,22424
|
179
179
|
piccolo/query/methods/table_exists.py,sha256=0yb3n6Jd2ovSBWlZ-gl00K4E7Jnbj7J8qAAX5d7hvNk,1259
|
180
|
-
piccolo/query/methods/update.py,sha256=
|
180
|
+
piccolo/query/methods/update.py,sha256=KNrx5yzY3gshTNzXf392M7Aamz7TPZzZFHLhbDiEDu8,3716
|
181
181
|
piccolo/query/operators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
182
182
|
piccolo/query/operators/json.py,sha256=hdo1M6N9qTHJTJ0sRV9Bwt_iQZTgs4VdCKOPH1sXe-k,3168
|
183
183
|
piccolo/testing/__init__.py,sha256=pRFSqRInfx95AakOq54atmvqoB-ue073q2aR8u8zR40,83
|
@@ -199,6 +199,7 @@ piccolo/utils/sync.py,sha256=j9Abkxn5HHS6HyvfpMzb1zV_teTkFHVhaIxu9rrSwSU,819
|
|
199
199
|
piccolo/utils/warnings.py,sha256=ONrurw3HVCClUuHnpenMjg45dcFesrXqMgG9ifgP4_8,1247
|
200
200
|
piccolo/utils/graphlib/__init__.py,sha256=SUJ5Yh7LiRun3nkBuLUSVmGNHF6fANrxSoYan0mtYB0,200
|
201
201
|
piccolo/utils/graphlib/_graphlib.py,sha256=9FNGDSmTIEAk86FktniCe_J2yXjSE_sRZHDBAJJAUOw,9677
|
202
|
+
piccolo-1.24.2.dist-info/licenses/LICENSE,sha256=zFIpi-16uIJ420UMIG75NU0JbDBykvrdnXcj5U_EYBI,1059
|
202
203
|
profiling/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
203
204
|
profiling/run_profile.py,sha256=264qsSFu93NTpExePnKQ9GkcN5fiuRBQ72WOSt0ZHck,829
|
204
205
|
tests/apps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -262,7 +263,7 @@ tests/columns/test_choices.py,sha256=q8TLe7nvGERXyGO_XEryEBR-DuWwFY1jPpscsrXjdXo
|
|
262
263
|
tests/columns/test_combination.py,sha256=BuBwR7k5X1EkOWraZpjqU6gvtb6ow_k-7N1KQBiW2RA,1681
|
263
264
|
tests/columns/test_date.py,sha256=QLC6kJMQwM-1mbUP4ksJVM7P8WwjzGZyynH3rHHdSew,1030
|
264
265
|
tests/columns/test_db_column_name.py,sha256=0wz6y4GNGy4nhMdHmYzEnChQGpK2UhWFFKrnmmML3Mk,9027
|
265
|
-
tests/columns/test_defaults.py,sha256=
|
266
|
+
tests/columns/test_defaults.py,sha256=SUY00eMpYSmEyl6UvGRjd_HwW5wC_tkHrwCDcYzlkUQ,3872
|
266
267
|
tests/columns/test_double_precision.py,sha256=7rhcSfDkb2fBh_zEG4UGwD_GW1sy6U9-8NooHuCS09Q,544
|
267
268
|
tests/columns/test_get_sql_value.py,sha256=mKgsInN374jzV99y9mg_ZiG-AvnJgz36SZi89xL7RZM,1768
|
268
269
|
tests/columns/test_integer.py,sha256=IcIQq0gF29gTxLY3CJuXtE13-20emqisY2wRQsu80F4,772
|
@@ -334,7 +335,7 @@ tests/table/test_count.py,sha256=qm4dwlQJ5gv8FPSsgYTS-3Gsd_KLgvWlFnmXweKydxw,229
|
|
334
335
|
tests/table/test_create.py,sha256=d-X7faDGI6NesvElu9JhrAo0Ialmrl6163Whd_LAUDQ,2887
|
335
336
|
tests/table/test_create_db_tables.py,sha256=9ZVlv9jGX5uneMfM5c2j1LlOphgorFNHN1cQ1pay4gM,903
|
336
337
|
tests/table/test_create_table_class.py,sha256=jOAxc38OhHBhdMzjsTOlYyzRjygj_5LXtsk46vmON_E,1745
|
337
|
-
tests/table/test_delete.py,sha256=
|
338
|
+
tests/table/test_delete.py,sha256=NTUv3Dgo4cZp2kmIId4eBug3eW1IYVEtvs4AaQS14iA,1630
|
338
339
|
tests/table/test_drop_db_tables.py,sha256=0a_aBZ8BMSLnu_DFXE_29X01B0jLdaa_WQ5_qTaZ5XY,1060
|
339
340
|
tests/table/test_exists.py,sha256=AHvhodkRof7PVd4IDdGQ2nyOj_1Cag1Rpg1H84s4jU0,283
|
340
341
|
tests/table/test_from_dict.py,sha256=I4PMxuzgkgi3-adaw9Gr3u5tQHexc31Vrq7RSPcPcJs,840
|
@@ -379,9 +380,8 @@ tests/utils/test_sql_values.py,sha256=vzxRmy16FfLZPH-sAQexBvsF9MXB8n4smr14qoEOS5
|
|
379
380
|
tests/utils/test_sync.py,sha256=9ytVo56y2vPQePvTeIi9lHIouEhWJbodl1TmzkGFrSo,799
|
380
381
|
tests/utils/test_table_reflection.py,sha256=SIzuat-IpcVj1GCFyOWKShI8YkhdOPPFH7qVrvfyPNE,3794
|
381
382
|
tests/utils/test_warnings.py,sha256=NvSC_cvJ6uZcwAGf1m-hLzETXCqprXELL8zg3TNLVMw,269
|
382
|
-
piccolo-1.24.
|
383
|
-
piccolo-1.24.
|
384
|
-
piccolo-1.24.
|
385
|
-
piccolo-1.24.
|
386
|
-
piccolo-1.24.
|
387
|
-
piccolo-1.24.0.dist-info/RECORD,,
|
383
|
+
piccolo-1.24.2.dist-info/METADATA,sha256=zrjcB9J7oo9wGk6Z19Xgpm6Iupa_8VymJ9OOpIUMvA8,5531
|
384
|
+
piccolo-1.24.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
385
|
+
piccolo-1.24.2.dist-info/entry_points.txt,sha256=SJPHET4Fi1bN5F3WqcKkv9SClK3_F1I7m4eQjk6AFh0,46
|
386
|
+
piccolo-1.24.2.dist-info/top_level.txt,sha256=-SR74VGbk43VoPy1HH-mHm97yoGukLK87HE5kdBW6qM,24
|
387
|
+
piccolo-1.24.2.dist-info/RECORD,,
|
tests/columns/test_defaults.py
CHANGED
@@ -22,6 +22,8 @@ from piccolo.columns.column_types import (
|
|
22
22
|
TimestampNow,
|
23
23
|
Varchar,
|
24
24
|
)
|
25
|
+
from piccolo.columns.defaults.timestamp import TimestampCustom
|
26
|
+
from piccolo.columns.defaults.timestamptz import TimestamptzCustom
|
25
27
|
from piccolo.table import Table
|
26
28
|
|
27
29
|
|
@@ -98,3 +100,35 @@ class TestDefaults(TestCase):
|
|
98
100
|
ForeignKey(references=MyTable, default=1)
|
99
101
|
with self.assertRaises(ValueError):
|
100
102
|
ForeignKey(references=MyTable, default="hello world")
|
103
|
+
|
104
|
+
|
105
|
+
class TestDatetime(TestCase):
|
106
|
+
|
107
|
+
def test_datetime(self):
|
108
|
+
"""
|
109
|
+
Make sure we can create a `TimestampCustom` / `TimestamptzCustom` from
|
110
|
+
a datetime, and then convert it back into the same datetime again.
|
111
|
+
|
112
|
+
https://github.com/piccolo-orm/piccolo/issues/1169
|
113
|
+
|
114
|
+
"""
|
115
|
+
datetime_obj = datetime.datetime(
|
116
|
+
year=2025,
|
117
|
+
month=1,
|
118
|
+
day=30,
|
119
|
+
hour=12,
|
120
|
+
minute=10,
|
121
|
+
second=15,
|
122
|
+
microsecond=100,
|
123
|
+
)
|
124
|
+
|
125
|
+
self.assertEqual(
|
126
|
+
TimestampCustom.from_datetime(datetime_obj).datetime,
|
127
|
+
datetime_obj,
|
128
|
+
)
|
129
|
+
|
130
|
+
datetime_obj = datetime_obj.astimezone(tz=datetime.timezone.utc)
|
131
|
+
self.assertEqual(
|
132
|
+
TimestamptzCustom.from_datetime(datetime_obj).datetime,
|
133
|
+
datetime_obj,
|
134
|
+
)
|
tests/table/test_delete.py
CHANGED
@@ -44,3 +44,18 @@ class TestDelete(DBTestCase):
|
|
44
44
|
Band.delete().run_sync()
|
45
45
|
|
46
46
|
Band.delete(force=True).run_sync()
|
47
|
+
|
48
|
+
def test_delete_with_joins(self):
|
49
|
+
"""
|
50
|
+
Make sure delete works if the `where` clause specifies joins.
|
51
|
+
"""
|
52
|
+
|
53
|
+
self.insert_rows()
|
54
|
+
|
55
|
+
Band.delete().where(Band.manager._.name == "Guido").run_sync()
|
56
|
+
|
57
|
+
response = (
|
58
|
+
Band.count().where(Band.manager._.name == "Guido").run_sync()
|
59
|
+
)
|
60
|
+
|
61
|
+
self.assertEqual(response, 0)
|
File without changes
|
File without changes
|
File without changes
|