TypeDAL 3.17.0__py3-none-any.whl → 3.17.1__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.
Potentially problematic release.
This version of TypeDAL might be problematic. Click here for more details.
- typedal/__about__.py +1 -1
- typedal/core.py +3 -3
- typedal/helpers.py +24 -4
- {typedal-3.17.0.dist-info → typedal-3.17.1.dist-info}/METADATA +1 -1
- {typedal-3.17.0.dist-info → typedal-3.17.1.dist-info}/RECORD +7 -7
- {typedal-3.17.0.dist-info → typedal-3.17.1.dist-info}/WHEEL +0 -0
- {typedal-3.17.0.dist-info → typedal-3.17.1.dist-info}/entry_points.txt +0 -0
typedal/__about__.py
CHANGED
typedal/core.py
CHANGED
|
@@ -835,10 +835,10 @@ class TypeDAL(pydal.DAL): # type: ignore
|
|
|
835
835
|
def sql_expression(
|
|
836
836
|
self,
|
|
837
837
|
sql_fragment: str,
|
|
838
|
-
*raw_args:
|
|
838
|
+
*raw_args: Any,
|
|
839
839
|
output_type: str | None = None,
|
|
840
|
-
**raw_kwargs:
|
|
841
|
-
) ->
|
|
840
|
+
**raw_kwargs: Any,
|
|
841
|
+
) -> Expression:
|
|
842
842
|
"""
|
|
843
843
|
Creates a pydal Expression object representing a raw SQL fragment.
|
|
844
844
|
|
typedal/helpers.py
CHANGED
|
@@ -337,6 +337,26 @@ class classproperty:
|
|
|
337
337
|
return self.fget(owner)
|
|
338
338
|
|
|
339
339
|
|
|
340
|
+
def smarter_adapt(db: TypeDAL, placeholder: Any) -> str:
|
|
341
|
+
"""
|
|
342
|
+
Smarter adaptation of placeholder to quote if needed.
|
|
343
|
+
|
|
344
|
+
Args:
|
|
345
|
+
db: Database object.
|
|
346
|
+
placeholder: Placeholder object.
|
|
347
|
+
|
|
348
|
+
Returns:
|
|
349
|
+
Quoted placeholder if needed, except for numbers (smart_adapt logic)
|
|
350
|
+
or fields/tables (use already quoted rname).
|
|
351
|
+
"""
|
|
352
|
+
return typing.cast(
|
|
353
|
+
str,
|
|
354
|
+
getattr(placeholder, "sql_shortref", None) # for tables
|
|
355
|
+
or getattr(placeholder, "sqlsafe", None) # for fields
|
|
356
|
+
or db._adapter.smart_adapt(placeholder), # for others
|
|
357
|
+
)
|
|
358
|
+
|
|
359
|
+
|
|
340
360
|
def sql_escape(db: TypeDAL, sql_fragment: str, *raw_args: Any, **raw_kwargs: Any) -> str:
|
|
341
361
|
"""
|
|
342
362
|
Generates escaped SQL fragments with placeholders.
|
|
@@ -358,18 +378,18 @@ def sql_escape(db: TypeDAL, sql_fragment: str, *raw_args: Any, **raw_kwargs: Any
|
|
|
358
378
|
|
|
359
379
|
elif raw_args:
|
|
360
380
|
# list
|
|
361
|
-
return sql_fragment % tuple(db
|
|
381
|
+
return sql_fragment % tuple(smarter_adapt(db, placeholder) for placeholder in raw_args)
|
|
362
382
|
else:
|
|
363
383
|
# dict
|
|
364
|
-
return sql_fragment % {key: db
|
|
384
|
+
return sql_fragment % {key: smarter_adapt(db, placeholder) for key, placeholder in raw_kwargs.items()}
|
|
365
385
|
|
|
366
386
|
|
|
367
387
|
def sql_expression(
|
|
368
388
|
db: TypeDAL,
|
|
369
389
|
sql_fragment: str,
|
|
370
|
-
*raw_args:
|
|
390
|
+
*raw_args: Any,
|
|
371
391
|
output_type: str | None = None,
|
|
372
|
-
**raw_kwargs:
|
|
392
|
+
**raw_kwargs: Any,
|
|
373
393
|
) -> Expression:
|
|
374
394
|
"""
|
|
375
395
|
Creates a pydal Expression object representing a raw SQL fragment.
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
typedal/__about__.py,sha256=
|
|
1
|
+
typedal/__about__.py,sha256=qAZyDEIwd6mDBYvr4cbjRjrTOK9zmsnsE0z1CgbpiGM,207
|
|
2
2
|
typedal/__init__.py,sha256=mCU8C3xPYiGcai4PYIoZNJSkFa1jb0MHkV8s2XXqEeY,484
|
|
3
3
|
typedal/caching.py,sha256=6YUzUMpan56nSy3D-Jl0FS-8V4LbTnpRSoDJHj6yPYo,11782
|
|
4
4
|
typedal/cli.py,sha256=e08L8k6q1NGSzpKs7ywin0uwkK7Kz07I4REVjHdbyyE,19267
|
|
5
5
|
typedal/config.py,sha256=0qy1zrTUdtmXPM9jHzFnSR1DJsqGJqcdG6pvhzKQHe0,11625
|
|
6
|
-
typedal/core.py,sha256=
|
|
6
|
+
typedal/core.py,sha256=OfmymoVBUX72srUpRhs1870My-jPnPbjWDubdpMBbUU,117708
|
|
7
7
|
typedal/fields.py,sha256=bZIgjl3Lj7eMqFCyt-bogsS_BqIs3cETEUH4W59qiXw,8425
|
|
8
8
|
typedal/for_py4web.py,sha256=KIIu8XgnAfRQCJfZCra79k8SInOHiFuLDKUv3hzTJng,1908
|
|
9
9
|
typedal/for_web2py.py,sha256=xn7zo6ImsmTkH6LacbjLQl2oqyBvP0zLqRxEJvMQk1w,1929
|
|
10
|
-
typedal/helpers.py,sha256=
|
|
10
|
+
typedal/helpers.py,sha256=fvej53MqWG1n78-uTuxUEfLDpKrXJDOaIysogBFT3ns,11298
|
|
11
11
|
typedal/mixins.py,sha256=NiGp-3Lr1lllWjP-whUhc_2HXwCS_ROB0bs5N_s9wk4,7976
|
|
12
12
|
typedal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
typedal/types.py,sha256=1FIgv1s0be0E8r5Wd9E1nvDvK4ETV8u2NlfI7_P6UUY,6752
|
|
14
14
|
typedal/web2py_py4web_shared.py,sha256=UYmD0_aK1bSVBt_f3j59Mxq-zOmQNkYkb8sPDUibq68,1539
|
|
15
15
|
typedal/serializers/as_json.py,sha256=3JZlFhPrdvZVFAmH7P5DUAz8-TIk-br0F1CjKG3PFDM,2246
|
|
16
|
-
typedal-3.17.
|
|
17
|
-
typedal-3.17.
|
|
18
|
-
typedal-3.17.
|
|
19
|
-
typedal-3.17.
|
|
16
|
+
typedal-3.17.1.dist-info/METADATA,sha256=d_6jgk1GPhrjkjP2XhqIDNN0bfI1cJ-GwohpNNby_Z8,10461
|
|
17
|
+
typedal-3.17.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
18
|
+
typedal-3.17.1.dist-info/entry_points.txt,sha256=m1wqcc_10rHWPdlQ71zEkmJDADUAnZtn7Jac_6mbyUc,44
|
|
19
|
+
typedal-3.17.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|