This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:const:`PARSE_DECLTYPES` and :const:`PARSE_COLNAMES`
to enable this.
Column names takes precedence over declared types if both flags are set.
Types cannot be detected for generated fields (for example ``max(data)``),
even when the *detect_types* parameter is set; :class:`str` will be
returned instead.
By default (``0``), type detection is disabled.
:param isolation_level:
Expand Down
Expand Up
@@ -430,21 +427,6 @@ Module constants
old style (pre-Python 3.12) transaction control behaviour.
See :ref:`sqlite3-transaction-control-isolation-level` for more information.
.. data:: PARSE_COLNAMES
Pass this flag value to the *detect_types* parameter of
:func:`connect` to look up a converter function by
using the type name, parsed from the query column name,
as the converter dictionary key.
The type name must be wrapped in square brackets (``[]``).
.. code-block:: sql
SELECT p as "p [point]" FROM test; ! will look up converter "point"
This flag may be combined with :const:`PARSE_DECLTYPES` using the ``|``
(bitwise or) operator.
.. data:: PARSE_DECLTYPES
Pass this flag value to the *detect_types* parameter of
Expand All
@@ -466,6 +448,27 @@ Module constants
This flag may be combined with :const:`PARSE_COLNAMES` using the ``|``
(bitwise or) operator.
.. note::
Generated fields (for example ``MAX(p)``) are returned as :class:`str`.
Use :const:`!PARSE_COLNAMES` to enforce types for such queries.
.. data:: PARSE_COLNAMES
Pass this flag value to the *detect_types* parameter of
:func:`connect` to look up a converter function by
using the type name, parsed from the query column name,
as the converter dictionary key.
The query column name must be wrapped in double quotes (``"``)
and the type name must be wrapped in square brackets (``[]``).
.. code-block:: sql
SELECT MAX(p) as "p [point]" FROM test; ! will look up converter "point"
This flag may be combined with :const:`PARSE_DECLTYPES` using the ``|``
(bitwise or) operator.
.. data:: SQLITE_OK
SQLITE_DENY
SQLITE_IGNORE
Expand Down
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[3.12] gh-131002: clarify how to enforce sqlite3 column types for generated fields (GH-131006) #131386
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.12] gh-131002: clarify how to enforce sqlite3 column types for generated fields (GH-131006) #131386
Filter by extension
Viewed files
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing