@@ -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:
@@ -436,21 +433,6 @@ Module constants
436
433
old style (pre-Python 3.12) transaction control behaviour.
437
434
See :ref: `sqlite3-transaction-control-isolation-level ` for more information.
438
435
439
- .. data :: PARSE_COLNAMES
440
-
441
- Pass this flag value to the *detect_types * parameter of
442
- :func: `connect ` to look up a converter function by
443
- using the type name, parsed from the query column name,
444
- as the converter dictionary key.
445
- The type name must be wrapped in square brackets (``[] ``).
446
-
447
- .. code-block :: sql
448
-
449
- SELECT p as "p [point]" FROM test; ! will look up converter "point"
450
-
451
- This flag may be combined with :const: `PARSE_DECLTYPES ` using the ``| ``
452
- (bitwise or) operator.
453
-
454
436
.. data :: PARSE_DECLTYPES
455
437
456
438
Pass this flag value to the *detect_types * parameter of
@@ -472,6 +454,25 @@ Module constants
472
454
This flag may be combined with :const: `PARSE_COLNAMES ` using the ``| ``
473
455
(bitwise or) operator.
474
456
457
+ Generated fields (for example ``MAX(data) ``) are returned as :class: `str `;
458
+ use :const: `!PARSE_COLNAMES ` to enforce types for such queries.
459
+
460
+ .. data :: PARSE_COLNAMES
461
+
462
+ Pass this flag value to the *detect_types * parameter of
463
+ :func: `connect ` to look up a converter function by
464
+ using the type name, parsed from the query column name,
465
+ as the converter dictionary key.
466
+ The query column name must be wrapped with double quotes (``" ``),
467
+ and the type name must be wrapped in square brackets (``[] ``),
468
+
469
+ .. code-block :: sql
470
+
471
+ SELECT MAX(p) as "p [point]" FROM test; ! will look up converter "point"
472
+
473
+ This flag may be combined with :const: `PARSE_DECLTYPES ` using the ``| ``
474
+ (bitwise or) operator.
475
+
475
476
.. data :: SQLITE_OK
476
477
SQLITE_DENY
477
478
SQLITE_IGNORE
0 commit comments