@@ -290,9 +290,6 @@ Module functions
290
290
:const: `PARSE_DECLTYPES ` and :const: `PARSE_COLNAMES `
291
291
to enable this.
292
292
Column names takes precedence over declared types if both flags are set.
293
- Types cannot be detected for generated fields (for example ``max(data) ``),
294
- even when the *detect_types * parameter is set; :class: `str ` will be
295
- returned instead.
296
293
By default (``0 ``), type detection is disabled.
297
294
298
295
:param isolation_level:
@@ -430,21 +427,6 @@ Module constants
430
427
old style (pre-Python 3.12) transaction control behaviour.
431
428
See :ref: `sqlite3-transaction-control-isolation-level ` for more information.
432
429
433
- .. data :: PARSE_COLNAMES
434
-
435
- Pass this flag value to the *detect_types * parameter of
436
- :func: `connect ` to look up a converter function by
437
- using the type name, parsed from the query column name,
438
- as the converter dictionary key.
439
- The type name must be wrapped in square brackets (``[] ``).
440
-
441
- .. code-block :: sql
442
-
443
- SELECT p as "p [point]" FROM test; ! will look up converter "point"
444
-
445
- This flag may be combined with :const: `PARSE_DECLTYPES ` using the ``| ``
446
- (bitwise or) operator.
447
-
448
430
.. data :: PARSE_DECLTYPES
449
431
450
432
Pass this flag value to the *detect_types * parameter of
@@ -466,6 +448,27 @@ Module constants
466
448
This flag may be combined with :const: `PARSE_COLNAMES ` using the ``| ``
467
449
(bitwise or) operator.
468
450
451
+ .. note ::
452
+
453
+ Generated fields (for example ``MAX(p) ``) are returned as :class: `str `.
454
+ Use :const: `!PARSE_COLNAMES ` to enforce types for such queries.
455
+
456
+ .. data :: PARSE_COLNAMES
457
+
458
+ Pass this flag value to the *detect_types * parameter of
459
+ :func: `connect ` to look up a converter function by
460
+ using the type name, parsed from the query column name,
461
+ as the converter dictionary key.
462
+ The query column name must be wrapped in double quotes (``" ``)
463
+ and the type name must be wrapped in square brackets (``[] ``).
464
+
465
+ .. code-block :: sql
466
+
467
+ SELECT MAX(p) as "p [point]" FROM test; ! will look up converter "point"
468
+
469
+ This flag may be combined with :const: `PARSE_DECLTYPES ` using the ``| ``
470
+ (bitwise or) operator.
471
+
469
472
.. data :: SQLITE_OK
470
473
SQLITE_DENY
471
474
SQLITE_IGNORE
0 commit comments